[Dojo-interest] Re:Question on AJAX with JSON

Jayaram jkrishnaswamy at comcast.net
Mon Jan 22 11:16:27 MST 2007


Blank1. The following is a suggested code to send AJAX request for JSON. Is the type aragument optional?
    Any of text/javascript, text/JSON, text/html, application/json all return the same. Looks like even removing this argument seems to work( unless I am getting cached results).

<HTML> 
<HEAD> 
<TITLE> </TITLE> 
<script type="text/javascript">
    var djConfig = {isDebug: true };
</script>
<script type="text/javascript" src="http://localhost/DoAjax/dojo.js"></script>

<SCRIPT LANGUAGE="JavaScript">

   var myVeryCoolObject = null;
var bindArgs = {
 url:  "http://localhost/JSONWebStudents.txt",
  type: "text/Javascript",
 load: function(type, data, evt){
  myVeryCoolObject = data;
    alert(myVeryCoolObject);
 }
};
dojo.io.bind(bindArgs);


</SCRIPT>

</HEAD> 

<BODY> 

</BODY> 
</HTML> 
2. To parse the myVeryCoolObject which happnes to be JSONText what would be the most convenient solution?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://dojotoolkit.org/pipermail/dojo-interest/attachments/20070122/fabf7243/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 145 bytes
Desc: not available
Url : http://dojotoolkit.org/pipermail/dojo-interest/attachments/20070122/fabf7243/attachment.gif


More information about the Dojo-interest mailing list