Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 ALL


  PHP to Objective C, where the f**k are parameters?

Javascript, PHP, Ruby functionsI assume you are very familiar with declaring functions in any of the languages above, if not, you should not be reading this. Let’s begin with a simple function to send email in these languages:// PHP or Javascriptdo_send_email (recipient, cc, subject, body);// Rubydo_send_email (recipient, cc, subject, body)So it’s clear by looking at the function’s signature that it takes 4 parameters and they could be optional, depends on your implementation. Even if you missed one parameter, in most cases it is fine, no complain, no fatal error.First enc...

3,822 0       PHP JAVASCRIPT PARAMETER OBJECTIVE-C FUNCTION NAME


  passing parameters to XMLHttpRequest’s onreadystatechange function

I’ve been smashing my head against this all day – but I finally got something working consistently and reliable, so I better damn well document it. This is as good a place as any, and hopefully it will be useful to others.I needed to make an Ajax call, so I turned to my good friend XMLHttpRequest. One wrinkle was that I needed to pass in a parameter to it… so I tried:var test = "bar";req = new XMLHttpRequest();req.open("GET", myURL, true);req.foo = test;req.onreadystatechange = function() { if (this.readyState != 4) return; if (this.status == 200) { aler...

13,191 1       AJAX JAVASCRIPT XMLHTTPREQUEST PARAMETER ONREADYSTATECHANGE