How to post value without refresh page?
I have some hyperlinks.I want click the link in div1, then post the different value and show in div2. Click diffrent link, the div2 will change to display different value. I need all the post without refresh the page.
<div id="div1"> <ul> <form method="POST" action="index.php"> <li> <input type="text" name="name" id="name"> <a href="index.php">test1</a> <input type="submit" name="sub" id="sub" value="test"> </li> <li> <input type="text" name="name" id="name"> <a href="index.php">test2</a> <input type="submit" name="sub" id="sub" value="test2"> </li> </form> </ul> </div> <div id="div2"> this is a <? $_POST["name"]; ?>, just a test. </div> The code above is wrong, just show my page struction. Can you give me a simple example? or some demos online? Thanks.
1 Answer
just try to use ajax i mean jquery ajax (post or get method)
see these: Posted: DesignShop 2 of 2 people found this answer helpful. Did you? Yes No Thanks, master, I have read jQuery.ajax and jQuery.post Form Submit Examples.
But when I post the value, my div1 is also display in index.php.
do you have a more closed example or Demo?
use append() in the success of ajax() |
© Advanced Web Core. All rights reserved