What would be the jQuery equivalent to the following Prototype AJAX Request?
function showSnapshotComments(snapshot) {
new Ajax.Request('/photos/show_snapshot_comments/'+ snapshot.id,
{asynchronous:true, evalScripts:true});
}
You could use the $.ajax()
function
function showSnapshotComments(snapshot) {
$.ajax({
url: '/photos/show_snapshot_comments/' + snapshot.id,
dataType: 'script'
});
}
or the $.getScript()
function if you prefer which is equivalent:
function showSnapshotComments(snapshot) {
$.getScript('/photos/show_snapshot_comments/' + snapshot.id);
}
$.ajax({
url: '/photos/show_snapshot_comments/'+ snapshot.id,
async: true,
dataType: 'script'
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With