|  | 
	                
  
    | 
	 
        อยากส่งค่าจาก message box ของ ajax เป็นค่า post ส่งยังไงหว่า     |  
    |  |  
 
              
  
    | 
 
        
          |  |  |  |  |  
          |  |  | 
            
              | เอกราช (แบบร่วมสมัย) 
 Code (JavaScript)
 
 
  var xhttp = new XMLHttpRequest();
  xhttp.open("POST", "2db.x", true);
  xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  xhttp.send("name=" + document.getElementById("person").innerHTML);
 
 เมืองขึ้น
 
 Code (JavaScript)
 
 
$(document).ready(function(){
  $("button").click(function(){
    $.post("2db.x",
    {
      name: $('#person').html($(this).text())
    },
    function(data,status){
      //alert("Data: " + data + "\nStatus: " + status);
    });
  });
});
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2020-04-24 11:41:13 | By :
                            PhrayaDev |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
 
        
          |  |  |  |  |  
          |  |  | 
            
              | Code (PHP) 
 <div class="model"> // bootstrap model
<input type="text" id="person">
<input type="button" name="btnSend" id="btnSend" value="Send">
</div>
<p></p>
<script src="http://code.jquery.com/jquery-latest.min.js"></script
<script>
		$(document).ready(function() {
			
			$(".model").on('click','#btnSend',function(e) {
				e.peventDefault();
				$.ajax({
				   type: "POST",
				   url: "check.php", // action
				   data: {
				   		person : $('#person').val(), // id value element
				   },
				   success: function(res) {
						$('p').empty().append(res); // response
				   }
				 });
			});
	
		});
</script>
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2020-04-24 11:54:08 | By :
                            Genesis™ |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 |  |