Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-31-2011, 12:23 AM   PM User | #1
dannio1984
New to the CF scene

 
Join Date: Feb 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
dannio1984 is an unknown quantity at this point
AJAX Form Submit methods

Hi,

I have a working AJAX script which submits a form great, posts the info to a php script and displays my results in a div and <p> tags.

I now have a new application for this form which means I want it to do the following:

#bespoke = the form id/name

Inputs to submit:
#bheight - submit on keyup
#bwidth - submit on keyup
#getprice = submit on change
#colour - submit on change

All the other inputs are hidden fields and get their contents dragged over when the above fields submit.

I am looking for a little help in converting this script to accept muliple on submit functions.

Code:
<script type="text/javascript">
		$(document).ready(function() {
			$("#bespoke").change(function() {
				var marginvar = $("#margin").val();
				var pricepercm = $("#price").val();
				var besheight = $("#bheight").val();
				var beswidth = $("#bwidth").val();
				var getpricevar = $("#getprice").val();
				var prodcodevar = $("#prodcode").val();
				var qtydis = $("#qtydiscounts").val();
				var r1 = $("#rate1").val();
				var r2 = $("#rate2").val();
				var r3 = $("#rate3").val();
				var r4 = $("#rate4").val();
				var colourselect = $("#colour").val();
				$.post("../../../pricing_bespoke.php", { margin: marginvar, price: pricepercm, bheight: besheight, bwidth: beswidth, getprice: getpricevar, prodcode: prodcodevar, qtydiscounts: qtydis, rate1: r1, rate2: r2, rate3: r3, rate4: r4, colour: colourselect }, function(data) {
					$("#status p").html(data);
				});
				return false;
			});
		});
	</script>
Thanks in advance!

Dan
dannio1984 is offline   Reply With Quote
Old 06-01-2011, 12:08 AM   PM User | #2
rnd me
Senior Coder

 
rnd me's Avatar
 
Join Date: Jun 2007
Location: Urbana
Posts: 3,462
Thanks: 9
Thanked 466 Times in 450 Posts
rnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the rough
Code:
$("#bespoke, #getprice, #colour").change(function() {
__________________
my site (updated 5/13)
STATS (2013/5) HTML5:90.2% MOB:14% IE7:0.5% IE8:8.6% IE9:9.8% IE10:10%
rnd me is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:44 PM.


Advertisement
Log in to turn off these ads.