Search
 
SCRIPT & CODE EXAMPLE
 

PHP

Get html by ajax

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>

$(document).ready(function(){
  $("button").click(function(){
    $.ajax({url: "sendHtml.php", success: function(result){
      $("#div1").html(result);
    }});
  });
});

</script>
</head>
<body>

<div id="div1"><h2>Let jQuery AJAX Change This Text</h2></div>

<button>Get External Content</button>

</body>
</html>
Comment

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();
Comment

PREVIOUS NEXT
Code Example
Php :: laravel where column different 
Php :: php laravel xml to json 
Php :: php ping test 
Php :: setup_postdata not working 
Php :: full name validation laravel 
Php :: laravel generate slug 
Php :: php add string inside string at position 
Php :: laravel flutter save image in data 
Php :: laravel app get locale 
Php :: guzzle http try catch 
Php :: get template part pass variable 
Php :: how to print array in laravel blade 
Php :: php subtract mins to datetime 
Php :: php get string before character 
Php :: laravel middleware route group 
Php :: how to add property to the request object 
Php :: php get class name of this 
Php :: smarty shorthand assign var 
Php :: sum multiple fields separately in laravel 
Php :: laravel get latest record by date 
Php :: codeigniter get parameter from url 
Php :: string to bool php 
Php :: php version check code 
Php :: remove html from string php 
Php :: MForm Attribute für Felder 
Php :: Search for text in string php 
Php :: docker invalid port 80 
Php :: one item limit on cart in woocommerce 
Php :: laravel s3 presigned url 
Php :: wordpress display post comment number 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =