Reputation: 7101
I use
$("#result").html(ajax_load).load(loadUrl, null, function (responseText) {
$('body').css('overflow-y', 'scroll');
});
to load a page inside a div and from the loaded page I tried to use:
$.ajax({
url: "link",
data: { 'device': device, 'latestDate': latestDate },
dataType: "jsonp"
})
and
$.getJSON equivalent.
Sometimes I can observe that the link is requested from $.ajax but I never managed to perform the request from $.getJSON.
Is it a really bad technique to call $.getJSON from code that is loaded dynamically?
Thanks.
Upvotes: 0
Views: 68
Reputation: 897
When using jQuery's ajax methods they can seem to fail silently. Try attaching some handlers to the ajax() like detailed here http://api.jquery.com/ajaxError/
More information can be found here - http://api.jquery.com/category/ajax/
Upvotes: 0
Reputation: 30015
No. $.getJSON
is really just a shorthand for $.ajax
. Its the same function with some minor syntax candy to make your life easier. If $.ajax
is working for you but $.getJSON
is not, then I have to conclude that your $.getJSON
statement is not really equivalent.
Upvotes: 1