I want to send both a key and a value that will be dynamic (and the key will be dynamic, as when a user logs in). Then how to send a request. I want something like this:
var requestString;
if(something)
requestString = "something";
else
requestString= "else";
jQuery.ajax({
url: handlerUrl,
dataType: "json",
data: {
requestString: request.term
}
});
Here, requestString is a variable and dynamically set. But for the current code. the key itself becomes "requestString", which must be dynamic. How to do it?
source
share