469,330 Members | 1,229 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,330 developers. It's quick & easy.

Can AJAX load variables for a Javascript Function?

I've used AJAX a little, but am wondering whether it can be used for this:
A Javascript function which draws a shape using the HTML5 canvas tool, but which gets the coordinates of the shape from an external document using AJAX.

Basically, can AJAX be used to dynamically import variables which can then be used by the rest of the Javascript code?

Thanks.
Sep 19 '10 #1
3 1817
johny10151981
1,059 1GB
Try to transfer data using XML. Ajax can load the xml data and then using xml parsing you can parse and assign to proper variable.
Sep 19 '10 #2
That's interesting. I've never done much with XML, but I'll look into it. Many thanks.
Sep 19 '10 #3
gits
5,390 Expert Mod 4TB
while XML would be an option it is often more to prefer to use a JSON-string to avoid the XML-parsing-overhead and in most cases even the bigger payload of the response. a JSON-structure could simply be evaluated to JavaScript ...
Sep 20 '10 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by David C. Holley | last post: by
1 post views Thread by Japhy | last post: by
1 post views Thread by mayur_hirpara | last post: by
5 posts views Thread by Turbo | last post: by
4 posts views Thread by Peter | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by haryvincent176 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.