An outlet for my obsession with technology
Archive for February, 2009
Dojo and ASP.NET AJAX Compatibility
Feb 13th
As part of developing a project I created a Cross-Domain Proxy to consume the payment service. My Cross-Domain Proxy, Payment.asmx, is exposed via the JavaScript end point. Any ASP.NET web service can open the JavaScript endpoint by uncommenting line #7 in the asmx file.
Once the ScriptService line is uncommented you can test that your service is exposing the JavaScript endpoint by calling a URL similar to:
1: ~/WebService.asmx/JS
In the master page I pull the service in.
1: <asp:ScriptManager ID="ocScriptManager" runat="server">
2: <Services>
3: <asp:ServiceReference Path="~/WebServices/Payment.asmx" />
4: </Services>
5: </asp:ScriptManager>
At this point everything works. I can write JavaScript to call back to the web service methods as such:
1: WebService.AddItem('item', CallBackFunction, FailFunction);
2:
3: CallBackFunction = function(){
4: alert('everything worked');
5: }
Now, I pull dojo into this project.
1: <script type="text/javascript">djConfig = { parseOnLoad: false, usePlainJson: true };</script>
2: <script type="text/javascript" src="http://dojopath/dojo.js"></script>
Here is where we start to run into problems. Due to, what I believe, is having both JavaScript APIs in the same project.
If we change the order of API loading we can get a, somewhat, clearer error message.
Now looking at line 1175 we see:
Conclusion:
I believe that I have exhausted my troubleshooting efforts. although I am not sure if this is enough information to validate the existence of a bug I opened a ticket with Dojo. Then again, I am not sure who can or should fix it.
http://trac.dojotoolkit.org/ticket/7353
I blogged about this once before.
http://eric.polerecky.com/archives/dijitformvalidationtextbox-and-aspnet-ajax/
Workaround:
In my project I use dojo.xhr to make calls back to the server.
Arguments passed to a JavaScript function
Feb 6th
The arguments passed to a JavaScript function are available in a function encapsulated variable named “arguments”
1: test = function(arg1, 'test', arrayArg){
2: console.log(arguments);
3: }
OOP Rant. Die Recordset Die!
Feb 5th
OOP
1: $user = new user();
2: $user.name = "eric";
3: $user.save(); //write to database
4:
5: $eric = user.fetchByName('eric'); //read from DB.
6: $eric.keepTyping();
Not OOP.
1: rs.Open "Select * from Customers", conn
2: for each x in rs.fields
3: response.write(x.name)
4: response.write(" = ")
5: response.write(x.value)
6: next
Ok, I am done.