An overview of jquery.ajax and making a request to the server -
ok perhaps have read many posts on subject , confused.
can please give brief overview of process follow in order make ajax request in jquery , pick results of call.
i suppose question 1 elect use jquery on javscript make xhr request?
i can see how javascript approach works, make sense , easy follow. various articles point benefit of using jquery claiming that
("#input_field1").load("ajax_request.php"); need make asynchronous call.
if case supposed jquery.ajax settings , global event handlers , how impact on .load
many thanks
jquery simplifies javascript make xhr requests, ajax request looks this:
$.ajax({ url: 'page.php', data: 'data=test', type: 'post', success: function(data){ // } }); here post variable 'data' value 'test' 'page.php', callback function success() called , can whatever data page.php returns.
$.load() different in can say:
$('#container').load('test.php'); and contents of 'test.php' placed element id of 'container'. here answer question yes, that's need make ajax request.
check out $.load() event handlers , variables here, , $.ajax ones here.
Comments
Post a Comment