How to get server response from an AJAX request using Jquery?
Submitted by: AdministratorWhen invoking functions that have asynchronous behavior We must provide a callback function to capture the desired result. This is especially important with AJAX in the browser because when a remote request is made, it is indeterminate when the response will be received.
Below an example of making an AJAX call and alerting the response (or error):
Code:
$.ajax({
url: 'pcdsEmpRecords.php',
success: function(response) {
alert(response);
},
error: function(xhr) {
alert('Error! Status = ' + xhr.status);
}
});
Submitted by:
Below an example of making an AJAX call and alerting the response (or error):
Code:
$.ajax({
url: 'pcdsEmpRecords.php',
success: function(response) {
alert(response);
},
error: function(xhr) {
alert('Error! Status = ' + xhr.status);
}
});
Submitted by:
Read Online JQuery Developer Job Interview Questions And Answers
Top JQuery Developer Questions
☺ | Explain jQuery? |
☺ | Why we need jQuery? |
☺ | What methods used to provide effects in JQuery? |
☺ | If you have a server control(asp.net server control, Button) and on the click of button you want to call a jquery function, So tell me how you will call a jquery function without postback? |
☺ | Explain jQuery connect? |
Top Scripting language Categories
☺ | AngularJS Interview Questions. |
☺ | Ext-JS Interview Questions. |
☺ | Dojo Interview Questions. |
☺ | Expert Developer JavaScript Interview Questions. |
☺ | SWFObject Interview Questions. |