I want to handle this process multiple of times on the same page. So I gave <div id="show"> a unique by appending "show" using php. However, when I submit the form from section 1 or section 2 it updated both show_1 and show_2.
Any suggestions?
<form action="script.php">
<input name="field1" value="123" type="radio" checked="checked" />
<input name="field2" value="456" type="hidden" />
<input name="field3" value="789" type="text" />
<input type="submit" value="post my form" />
</form>
<script>
$("form").submit(function(event) {
event.preventDefault();
$.post($(this).attr("action"),$(this).serializeArray(), function(php_msg) { $("#show_4").text(php_msg); });
})
</script>
<div id="show_4"></div>
2nd form on same page:
<form action="script.php">
<input name="field1" value="123" type="radio" checked="checked" />
<input name="field2" value="456" type="hidden" />
<input name="field3" value="789" type="text" />
<input type="submit" value="post my form" />
</form>
<script>
$("form").submit(function(event) {
event.preventDefault();
$.post($(this).attr("action"),$(this).serializeArray(), function(php_msg) { $("#show_5").text(php_msg); });
})
</script>
<div id="show_5"></div>
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Most Valuable Expert award recognizes technology experts who passionately share their knowledge with the community, demonstrate the core values of this platform, and go the extra mile in all aspects of their contributions. This award is based off of nominations by EE users and experts. Multiple MVEs may be awarded each year.