Answers for "ajax with jquery example"

6

ajax exmaple\

$.ajax({
    url:'your url',
    type: 'POST',  // http method
    data: { myData: 'This is my data.' },  // data to submit
    success: function (data, status, xhr) { // after success your get data
        $('p').append('status: ' + status + ', data: ' + data);
    },
    error: function (jqXhr, textStatus, errorMessage) { // if any error come then 
            $('p').append('Error' + errorMessage);
    }
});
Posted by: Guest on October-17-2020
0

ajax example

/*SM*/ 
$.ajax({
        method: "POST",
        url: "/controller/action",
        data: { name: "John", location: "Boston" },
        success: (result) => {
            console.log(result);
        },
        error: (error) => {
            console.log(error);
        }
    });
Posted by: Guest on May-09-2021
15

ajax jquery example

$.ajax({

   url     : "file.php",
   method  : "POST",

       data: { 
         //key                      :   value 
         action                   	:   action , 
         key_1   					:   value_key_1,
         key_2   					:   value_key_2
       }
   })

   .fail(function() { return false; })
	// Appel OK
   .done(function(data) {

   console.log(data);

 });
Posted by: Guest on May-05-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language