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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.