Friday, September 21, 2012

JQuery - Sample Ajax Call format



    $.ajax({
        //your type GET, POST, PUT etc
        type: "POST",
        //your call url 
        url: callurl,
        //your body data. Here sending as JSON format
        data:JSON.stringify(JSONData),
        //your header values, you can use beforesend: function() method also
        headers : {
            "header1":"value",
            "header2": "value"
        },
        //setting whether asynchronous process or not to get response before leave method
        async:false,
        //set cache
        cache:false,

        success: function (JSON-response) {
            //your code goes here when success
        },
        error: function (jqXHR, textStatus, errorThrown) {        
            //your error handle goes here
        }
    });

1 comment:

  1. i used as it is your ajax call(code from your link) but still not calling web service,

    ReplyDelete