jqueryjsoncallbackjquery-1.5

callback is added in JSON request of jQuery


I have these javascript codes in a page:

<script type="text/javascript">
$(function() { 
   $.getJSON("http://example.com/index.php/grid/fetch-grid", function(jsonData) {
    if (jsonData.status === true) {
        $("#parserFilterGridContainer").html(jsonData.content);
    } else {
        // Alert that loading failed
        alert(jsonData.content);
    }
    });
});
</script>

when I check it in firebug the url requested from the server is

"http://example.com/index.php/grid/fetch-grid?callback=.... (some numbers)"

instead of "http://example.com/index.php/$$$call$$$/grid/fetch-grid"

My jQuery version is v1.5.1. Is it because of my jQuery version? How can I resolve it ?


Solution

  • Ok,It is solved now. I upgrade my jquery from 1.5.1 to 1.7 and the problem is solved.It seems v1.5.1 treats with getJSON as JSONP instead of JSON.