Ques:- How To Use Ajax In Jquery?
Asked In :-
Rural Sourcing, raja software labs,
Right Answer:
To use Ajax in jQuery, you can use the `$.ajax()` method. Here’s a simple example:
```javascript
$.ajax({
url: 'your-url-here',
type: 'GET', // or 'POST'
dataType: 'json', // or 'html', 'text', etc.
success: function(data) {
console.log(data); // handle the response data
},
error: function(xhr, status, error) {
console.error(error); // handle errors
}
});
```
To use Ajax in jQuery, you can use the `$.ajax()` method. Here’s a simple example:
```javascript
$.ajax({
url: 'your-url-here',
type: 'GET', // or 'POST'
dataType: 'json', // or 'html', 'text', etc.
success: function(data) {
console.log(data); // handle the response data
},
error: function(xhr, status, error) {
console.error(error); // handle errors
}
});
```