Hello. I am trying to figure out why my $.getJSON method does not seem to be working but the $.ajax works just fine. First, here is my getJSON call:
$.getJSON("http://localhost:1505/getServiceImageList?callback=loadImagesInSelect", loadImagesInSelect);
You can see I have tried added the callback parameter directly to the query string (also tried it not on string) and I added a reference to the callback method defined in my js file.
Here is the $.ajax call which works just fine:
function getImages() {
$.ajax({
type: "GET",
url: $('#txt_registry_url').val(),
dataType: "jsonp",
success:loadImagesInSelect ,
error:function (xhr, ajaxOptions, thrownError) {
alert(xhr.status);
alert(thrownError);
}
});
}
In this example the url pulled from the text box is the same as in the straight call to getJSON. When the method call completes, the successMethod is called and everything processes just fine.
While I am cool with using the later of the two methods, the docs make it seem that the getJSON is the preferred shorthand way of doing things.
Can anyone please explain what I am missing on the shorthand method to make it all work?
Thanks in advance.