javascript - How to display content in php that is returned by ajax? -


i have webpage following ajax script:

<script>     $("#sendbtn").click(function() {         var text = $("#textarea").val();         var mail = $("#email").val();         var id= 1;          $.ajax({             url: 'savedatanow.php',             type: "post",             data: {                 text: text,                 mail: mail,                 id: id             },             success: function(response)             {                  $('#email').prop('disabled', true);                 $('#textarea').prop('disabled', true);                 $('#sendbtn').prop('disabled', true);                 alert("thanks!");              }         });      }); </script> 

and in savedatanow.php have part of code parse data , adds database. @ end of php file have command echo "added";, obvioulsy doesn't show up. there way of displaying returned data on webpage (besides using alert() in javascript)? maybe create div on webpage filled returned content, - should use on php site besides echo "";? , how should modify javascript?


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -