In very recent issues, I had problems with this. My code is:
$("#SearchResults").load("/Invoice/InvoiceSearchResults/");
And I was advised to use this instead:
$.ajax({ url: "/Invoice/InvoiceSearchResults/", type: 'GET', dataType: 'html',
from:
function doSubmitSuccess(result) { $(".SearchResults").html(result);
}
And then someone kindly tried to help me:
$.get(postUrl, function(data) { $("#posts").append(data); $('#ajaxLdMore').addClass('hideElement'); $('#ldMore').removeClass('hideElement'); });
Turns out my problem was that I'm an idiot. abd used the selector "#" instead of "."
I'm just wondering if I should change my code to any of them?
Are there real pros and cons of each approach or preference?
Is there a better way that no one has posted yet?
I am not trying to open a huge debate (I do not think :)). I just want to understand a little more about this.
thanks
source share