Friday, 15 June 2012

ajax - jQuery, how to call a function while passing a variable -


I want to use jQuery's .get method to send an AJAX call to the server.

I using this line:

  $ Receive ("InfoRetrieve", {}, addContent (data));  

As you can see, I want to call a function call addContent and pass it to the data that has been received from the server.

The function addContent is below:

  function addContent {data} {$ ("# 0001"). Attachment (data); }  

This does not seem to work, can you see why?

Just change it:

  $. Get ("InfoRetrieve", {}, addContent);  

This function will take care to pass data when calling.


No comments:

Post a Comment