0

In typescript I am trying to implement ajax async call and handle it through handler method. below is the code snippet:

var JQryAjxSetting: JQueryAjaxSettings = {
    url: "h***//test/test.svc/GetUploadId",
    type: "GET",
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    async: true,
    error: function (xhr, status, error) { alert(error); },
    success: function () { alert("success"); },
    jsonpCallback: 'SetUpLoadID',
};

In above declaration I expect a jsonpCallback: is the place where I handle call back. in "SetUpLoadID" I want to get the response which is serialized json data. So in SetUpLoadID method how will I receive data? similar to event will I get some variable where event.data will give me data sent from the server as a response?

1 Answer 1

5

In jQuery, the jsonpCallback is the name used when presenting the request to the server. The data is passed to your success function.

var JQryAjxSetting: JQueryAjaxSettings = {
    url: "h***//test/test.svc/GetUploadId",
    type: "GET",
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    async: true,
    error: function (xhr, status, error) { alert(error); },
    success: function (data) { alert(data); },
    jsonpCallback: 'itDoesntMatterNotAFunction',
};
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.