javascript ajax variable question..

Posted by Kelso on Stack Overflow See other posts from Stack Overflow or by Kelso
Published on 2010-03-17T15:09:01Z Indexed on 2010/03/17 15:11 UTC
Read the original article Hit count: 347

Filed under:
|
|

Hey there, new to AJAX, JS.. Im trying to add to a Javascript/Ajax search script that I've put together. Previously, it had a single search field, called search_word, I added one called search_date.

$(".search_button").click(function() {
var search_word = $("#search_box").val();
var search_date = $("#datepicker").val();
var dataString = 'search_word='+ search_word;

if(search_word=='')
{
}
else
{
$.ajax({
type: "GET",
url: "searchdata.php",
data: dataString,

In the Ajax, it appears to pass data of dataString, to my processing script. How do I add search date to the dataString so that I can use that var in my searchdata.php?

In searchdata, I can do this $search_word=$_GET['search_word']; and use that var, but so far every time i attempt to alter the dataString, it breaks all the other functionality.

Thanks!

© Stack Overflow or respective owner

Related posts about AJAX

Related posts about JavaScript