I am using the jquery .load()
method for a search. I have figured out how to send one variable, but I need to send many.
WITH ONE
var field1 = ($('#form1 input[name="field1"]:text').val());
$('#results').load("/search/show.php", {field1: field1});
How would I do two variables? THIS WONT WORK
var field1 = ($('#form1 input[name="field1"]:text').val());
var field2 = ($('#form1 input[name="field2"]:text').val());
$('#results').load("/search/show.php", {field1: field1}{field2: field2});
I'm sure there is an easy way to send multiple variables, I just don't know how!
You're looking for:
var field1 = ($('#form1 input[name="field1"]:text').val());
var field2 = ($('#form1 input[name="field2"]:text').val());
$('#results').load("/search/show.php", {field1: field1, field2: field2});
Check out object literals on the MDC.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With