I trying to make a simple image gallery, where I have several radio button groups to filter the search results.(I am pretty new to jquery, and started learning it today, so please be patient.)
1)I have tried this code to create an associative array, but the array comes up as blank. Any ideas?
$('input:radio:checked').each(function(){
searchCriteria[this.name]=this.value;
});
2)Along with that, can someone show me how to post the data to a php page( using jQuery ajax), using POST method?
Will this work?
$.post('testResults.php',searchCriteria,displayResult);
To every one trying to help:
The following code seems to work
$('input:radio:checked').each(function(){
searchCriteria.push(new addValue(this.name,this.value));
//searchCriteria['this.name']=this.value;
});
function addValue(a,b)
{
this.key=a;
this.val=b;
};
But that creates an object array…..why am I having problems creating the associative array?
try this:
ok, could be useful for you this output to send ajax?