Monday, June 1, 2009

[jQuery] Re: What is the best way to pass variable data from Python to jQuery?

Hi,

I dont know about python but I can suggest you, that you can retrive your data in json format.
To retrive data into json format you need set ajax request type : json
Means prepare one array in your server script assign your variables value into array key. 
Now here you have complete array with your expecting variables.
Now convert your array into encode format to send data to jquery ajax.
You can access those array key with reponse object
like alert(response.arrayKey);

Hope this will work for you.



On Mon, Jun 1, 2009 at 6:17 PM, sarah <smorgen@gmail.com> wrote:

In my code I have some python code that retrieves some data from a db
- and I need to pass some variables from the python code to my jQuery
scripts in order to perform an action.  The problem is - what is the
best way to pass this data?  So far in the office we've discussed
adding the variable data into the generated HTML via classes or some
other standard HTML attribute or use a custom attribute to store the
data.

What is the best way to accomplish this?  Are there other solutions we
haven't considered?

-Sarah



--
---| Regard |---

Mohd.Tareque

No comments: