php+ ajax
| From: | blackwater dev | Date: | Mon, 20 Feb 2006 21:00:32 +0000 |
| Subject: | php+ ajax | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-230765@lists.php.net to get a copy of this message | ||
Hello,
I am trying to do a pre-search to let the users know how many rows
will be returned before they actually hit submit. I think this is
more of a js question but :
I have this js function:
function preSearch() {
//Put the form data into a variable
var min_price= document.getElementById('min_price').value ;
var max_price= document.getElementById('max_price').value ;
document.getElementById('prop_num').innerHTML = "Searching...";
var url = 'ajax.php?min_price=' + min_price +'&max_price=' +
max_price;
xmlhttp.open('GET', url, true);
xmlhttp.onreadystatechange = function() {
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById('prop_num').innerHTML ='TotalRecords:
' + xmlhttp.responseText + ' ';
} else {
//If the PHP script fails to send a
response, or sends back an error, display a simple user-friendly
notification
document.getElementById('prop_num').innerHTML = '';
}
};
xmlhttp.send(null);
// }
}
And have this for inputs:
<input name="min_price" id="min_price"> etc.
I would really like to have all of my inputs has part of an arry so:
<input name="search[min_price]" id="search[min_price]"> etc
The problem is js seems to get confused trying to look this up by id
and I don't think I can use an array like this with a GET, how can I
use arrays for all this??
Thanks!