Take the 2-minute tour ×
<script type="text/javascript">
    var a='abc';

How can i send a local param with the ajax function?

share|improve this question
add comment

1 Answer

As indicated in the ajax() function documentation, the second argument to the function is an array of input field names, not arbitrary values. It reads the values stored in the named input fields and sends those values via a POST request. If you want to pass arbitrary values, you can do so by appending them to the URL in a query string:

var a = 'abc'
ajax('echo?a=' + a, [], 'result');

In that case, the value of a will be available within the echo() function as request.vars.a.

share|improve this answer
Thank you,that's help –  user2149071 Mar 12 '13 at 15:01
add comment

Your Answer


