Jump to content

jQuery submit help


Scropion

Recommended Posts

Hey I am coding a marketplace and I am using jQuery to togglePages and when I submit on a togglePage it always sends me to the starting page without submitting.

 

Any help on this??

 

<script type="text/javascript">
function togglePage(page) {
$("#contentField").load("includes/" + page + ".php");
  }

</script>

<div id="contentField">
<form method='POST' style='margin:1px'><select name='quantity' style='font-size:10px; font=face: verdana'>

Link to comment
https://forums.phpfreaks.com/topic/165770-jquery-submit-help/
Share on other sites

<select name='quantity' style='font-size:10px; font=face: verdana'><option value='0'>0</option><option value='1'>1</option><option value='2'>2</option><option value='3'>3</option><option value='4'>4</option><option value='5'>5</option><option value='6'>6</option><option value='7'>7</option><option value='8'>8</option><option value='9'>9</option></select><input type="hidden" name="purchase_item" value="Old"><br><br><input type="submit" name="purchase" value="Buy!"></form>

 

Thats it

Link to comment
https://forums.phpfreaks.com/topic/165770-jquery-submit-help/#findComment-876179
Share on other sites

A couple of line breaks would have been nice.

 

In your code I do not see any onchange even for the select element.

you can add the even like so:

<script>
$(document).ready(function(){
console.log('ready');
$("select:[name='quantity']").change(function(){
	alert(this.value);
});
});
</script>

 

You should be able to finish the rest of the code to get it working.

Link to comment
https://forums.phpfreaks.com/topic/165770-jquery-submit-help/#findComment-876274
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.