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
Post a Comment