How to modify parameters in $.get jquery with if statement
Hi I have the following code:
$j.get('url.php', {
"q": 'searchajax',
"search_textbox" : search_term,
"searchpage" : search_countpgload_tracker
}, function (data) {
if (data.indexOf('sorryxyznopostsfound') >= 0) {
}else{
$j('.search_div').append(data);
//Append the result to div class search_records.
}
});
I want to include an
extra parameter if a condition matches:
$j.get('url.php', {
"q": 'searchajax',
"search_textbox" : search_term,
"searchpage" : search_countpgload_tracker
if(a=='hello'){
"newparameter" : hello
}
}, function (data) {
if (data.indexOf('sorryxyznopostsfound') >= 0) {
}else{
$j('.search_div').append(data);
//Append the result to div class search_records.
}
});
How can i accomplish this? The above code does not work if i include if statement in get parameters listings.