Hi!

I'm kind of new at the world of ajax and jquery and i'm starting to
make a site with them.

In my site i've created a single function (in the header) called
ajaxQry(...) which takes some parameters like, url to make post or
get, if I need GEt or POST, the data type of the query, a success
function and an error function.

Anyway, it look like this:

function ajaxQry(sendVars, url, returnType, backFunction,
errorFunction){

         $.ajax({
          type: "POST",
          url: "ajax/"+url+".asp?nocache="+Math.random(),
          data: sendVars,
          success: backFunction, //ussully this loads the content in the main
page as html
          dataType: returnType,
          error: errorFunction
        });

}

Everything works great but i don't know if there's a better way to do
this, because in many events of the site I call this function... And
I'm starting to think that it's pretty insecure.... What do you think?


By the way i ussually call the url file (see the function) and return
HTML content, and then i load it in the page with $(selector).html();
is that okay?

Thanks! and sorry for my english :$

Reply via email to