jQuery — It begins

Written by James McDonald

August 2, 2010

So most day’s I’m an infrastructure and apps guy. Which means a bit of:

  • Cisco
  • Windows
  • ERP
  • And a heap of general IT

So then comes a long a project which requires coding…

And because my ERP spits out and receives XML and Internet browsers are very friendly with the stuff. I have to learn to:

  • XML
  • XSLT
  • Java Script
  • PHP
  • SOAP

However I’ve been wanting to abstract my javascript coding so that I don’t have to know the implementation specific details of XMLHTTPRequest on Firefox/IE/Chrome. So I’m going to teach myself the jQuery Javascript toolkit.

Incredibly powerful but I have a lot to learn.

One of the first things I’ve stumbled on is that modern browser implementations will not in any way allow scripted requests to resources outside their current domain. Even when the domain is the same but the port is different, you are in for a big dose of FAIL. This is because of the Same Origin Policy.

The work around is to host a script on the domain you are on which takes the client request and then passes it on to the remote resource, receives the reply, and passes it back to the client.

So this is my first hurdle. Sending an XML SOAP request using the HTTP POST method to a proxy script and then getting back the reply.

I’m currently looking at using PHP which has a libcurl interface
http://curl.haxx.se/libcurl/php/examples/blogpost.html
The script should recognize and pass on the necessary SOAP Headers. At the moment I’m scouring the web looking for hints on how to implement it all… There are some very good samples at www.bennadel.com.

Funny thing is, when you come across someone who really understands a subject and can verbalize it correctly, but uses slightly different tools and frameworks. Then you have to translate how they are doing it correctly across to the Opensource tools you are trying to use.

So for the moment it’s a learning ramp… www.learningjquery.com, www.jquery.com. I’ll post suitably obfuscated working examples as I figure it all out myself.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

You May Also Like…