Answers for "get response ajax jquery"

7

jquery ajax get

$.ajax({
    	url: "www.site.com/page",
    	success: function(data){ 
    	    $('#data').text(data);
    	},
    	error: function(){
    		alert("There was an error.");
    	}
    });
Posted by: Guest on March-28-2020
2

ajax get html response

//your jquery code will be like this:
$.ajax({
      type: 'POST',
      url: $url,
      data: new FormData(this),
      dataType: 'json',
      contentType: false,
      processData:false,//this is a must
      success: function(response){ 
      		$('your_selector').html(response);
      }
});

//php code will be like this
echo '<div>some html code</div>';
die();
Posted by: Guest on June-11-2021
0

jquery ajax responseText

// To get jquery AJAX calls working
// remember to add Jquery to your head tag:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>

var response = null;
var responseTextValue = null;

$.ajax({
	type: "GET",   
	url: "<Your url text>",   
	async: false,
	success : function(data) {
		// Here you can specify that you need some exact value like responseText
		responseTextValue = data.responseText;
	    response = data;
	}
});
Posted by: Guest on September-29-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language