Jquery.load () with multiple variables

I am using jquery .load() method to search. I figured out how to send one variable, but I need to send a lot.

WITH ONE

 var field1 = ($('#form1 input[name="field1"]:text').val()); $('#results').load("/search/show.php", {field1: field1}); 

How would I make two variables? THIS PROFESSION

 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 to do this.

+4
source share
1 answer

You are 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}); 

Browse object literals on the MDC .

+7
source

All Articles