Navigation

    APPDRAG Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular

    REMINDER

    Please be respectful of all AppDragers! Keep it really civil so that we can make the AppDrag community of builders as embracing, positive and inspiring as possible.

    Ability to modify documentation defaults

    Features requests
    2
    3
    342
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Daniel Mulroy
      Daniel Mulroy last edited by

      Hello team,

      I'd love to know if it were possible to edit the default structure/code samples in the documentation, or the way they are generated.

      For example, for a request like this:

      var settings = {
          "url": "https://my.server/api/endpoint",
          "data": {
              "token" : "abcde",
              "videoID" : "o2in43ntek",
              "uniqueUsersOnly" : "0",
              "company" : "2"
          },
          "method": "POST",
          "async": true,
          "crossDomain": true,
          "processData": true
      };
      $.ajax(settings).done(function (response) {
          console.log(response); // TODO: Do something with the result
      });
      

      I would like to add:

      json: true
      

      To the list of parameters so that the response is automatically treated / parsed as JSON.

      It's a small example 🙂

      T 1 Reply Last reply Reply Quote 0
      • T
        Thomas D @Daniel Mulroy last edited by

        Hm, do you mean add JSON.parse(response) to the result object?

        1 Reply Last reply Reply Quote 0
        • Daniel Mulroy
          Daniel Mulroy last edited by

          Whoops, sorry. I meant

          dataType: "json"
          

          Yes, you could add "response = JSON.parse(response)", for example. But, if you add "json" : "true" to the parameters, jQuery's ajax function will automatically parse it for you 🙂

          From jQuery's docs:
          https://api.jquery.com/jquery.ajax (search 'dataType')

          I'd also prefer to add default error handling logic, for example... so, adding a

          .catch(function (error) {
                myErrorReportingFunction(error);
          }
          

          That, for example, would be very, very helpful.

          1 Reply Last reply Reply Quote 1
          • First post
            Last post