JQuery is equivalent to Ajax.Request prototype

What will be jQuery equivalent to the following Prototype AJAX query?

function showSnapshotComments(snapshot) { new Ajax.Request('/photos/show_snapshot_comments/'+ snapshot.id, {asynchronous:true, evalScripts:true}); } 
+4
source share
2 answers
 $.ajax({ url: '/photos/show_snapshot_comments/'+ snapshot.id, async: true, dataType: 'script' }); 
+5
source

You can use the $.ajax() function

 function showSnapshotComments(snapshot) { $.ajax({ url: '/photos/show_snapshot_comments/' + snapshot.id, dataType: 'script' }); } 

or $.getScript() if you prefer, which is equivalent to:

 function showSnapshotComments(snapshot) { $.getScript('/photos/show_snapshot_comments/' + snapshot.id); } 
+7
source

Source: https://habr.com/ru/post/1346629/


All Articles