Have an account? Sign in
Login  Register  Facebook
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.
Started: September 21, 2011 Latest Activity: September 21, 2011 jquery
1 Answer
just try to use ajax i mean jquery ajax (post or get method)
see these:

Posted: DesignShop
In: September 21, 2011

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?
September 21, 2011

use append() in the success of ajax()
September 21, 2011

Your Answer

xDo you want to answer this question? Please login or create an account to post your answer