Im new to the ajax jquery i read about it and mess around with the codes but im still not understanding on some stuff , Im trying to creating a message form, i want my script in php processes the message and when theirs a error, i want the error to show on the same page of the form and i also dont want the page to refresh when click submit.
here what i got , i know its not a lot im still trying to understand on how to work with ajax jquery
<script>
$.post("message/sendm.php", {message:"#message" } );
</script>
<div id="send" style="color:#000" class="reveal-modal">
<form name="message" method="post" style="background:#999">
<table>
<tr><td>To:<?php echo $user ?></td></tr>
<tr><td>Message:<textarea style="resize:none" id="message"name="text" rows="10" cols="60"></textarea></td></tr>
<tr><td><input name="message" type="submit" value="Send!"></td></tr>
</form>
</table>
i know its not a lot im still trying to understand on how to work with ajax jquery and if anyone knows a good book to learn ajax jquery please let me know. I already try the jquery website its not really useful it doesnt explain everything, like it doesnt explain on how to send $_Post to the php page to process any errors and how to show them on the same page
You can use jQuery to make ajax calls to a server. A method I like to use is:
Then you just have to create a page on your server for processing the information (in my example it would be myform.php. Anything you output from the php page (i.e. using echo) will show up in the element with the id alerts.
Hope this was helpful.