simple mootools AJAX call

using javascript with mootools,
I want a function that does a synchronous post ajax call with parameters,
and returns the resulting JSON

function simple_ajax(url, params) {
    // url is a standard url
    // params looks something like {'post_param1' : 'value1', 'post_param2' : 'value2'}

    ... what goes here? (probably uses toQueryString)...

    return eval(result)
}
xomnAsked:
Who is Participating?
 
hieloCommented:
Better yet:
new ajax(url,{postBody:params, onComplete: function(request){processResult(request);}, update: 'targetDivId'}).request();
function processResult(requestObj)
{
      alert(result.responseText);
      //use this if you are returning JSON
      /*
      var data="";
      eval("data="+result.responseText+";");
      */
}
0
 
hieloCommented:
new ajax(url,{postBody:params, onComplete: handlingFunction, update: 'targetDivId'}).request();
0
 
ahoffmannCommented:
>       eval("data="+result.responseText+";");
outch, hopefully there is no posibility for an attacker to manipulate this data ...

evil eval ...
0
 
Computer101Commented:
Forced accept.

Computer101
EE Admin
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.