JSONP with new parameter, but not using Data

JSONP with new parameter, but not using Data

ghafarizghafariz Posts: 14Questions: 6Answers: 0

hello, i want to ask something maybe strange
my code is trying to make a request to other subdomain, and it will be using JSONP.
my first attempt is using POST method but i just know that JSONP only GET.
and now i cannot append new data on the JS using ajax.data
is there some way for me to add data before make an ajax call? like adding the data inside the table.. idk im just guessing here no clue at all
thanks for the respond

Answers

  • kthorngrenkthorngren Posts: 21,315Questions: 26Answers: 4,948
    edited February 2022

    and now i cannot append new data on the JS using ajax.data

    You should be able to use aax.data with either POST or GET requests. See the examples in the docs and the live example. Please describe the problem you are having with ajax.data in more detail.

    is there some way for me to add data before make an ajax call? like adding the data inside the table.

    Sorry, I don't understand what you mean by "like adding the data inside the table". Please provide more details.

    Use the browser's network inspector tool to see what parameters are being sent.

    Kevin

  • ghafarizghafariz Posts: 14Questions: 6Answers: 0

    im trying to do an ajax call with crossdomain, and it supposed to ONLY GET method. but crossdomain cannot be append any new data with ajax.data. is there any way to append the data inside the datatables parameter (maybe on search query or anything else)

  • allanallan Posts: 63,488Questions: 1Answers: 10,467 Site admin

    I'm fairly sure it can. Something like:

            ajax: {
                url: "scripts/jsonp.php",
                dataType: "jsonp",
                data: function (d) {
                  d.extra = true;
                }
            }
    

    Should work just fine. It will be a query parameter of course, but it should work. If it doesn't please link to a test case showing the issue.

    Allan

Sign In or Register to comment.