I want to send both the key and value to be dynamic(and the key is dynamic like coming from user input). Then how to send the 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 current code. the key is itself becoming "requestString" which was ought to be dynamic. How to do this?
Use
jQuery.ajax({
           url: handlerUrl,
           dataType: "json",
           data: requestString + '=' + request.term
      });
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With