Welcome Guest, Not a member yet? Register   Sign In
jQuery Kills PHP Variables
#8

[eluser]spamguy[/eluser]
[quote author="Randy Casburn" date="1225051506"]That was my thought initially too Colin. When I had this problem with AJAX I thought I recalled it was because I was setting the $data variable in the __contstruct() method and calling the setter() method directly that used $this->data. As spamguy described, when called with an HTTP request it would work fine, but with an XMLHttpRequest it wouldn't. I ran up against a deadline, moved the variable to the setter() method for $data and it worked.

That supports your hypothesis. I'd be curious to know "the rest of the story" as Paul Harvey says.

Randy[/quote]

Sorry for the delay in getting back to this question.

You both are technically right: there is more code than I previously showed. However, I commented it all out and tested before posting it here.

As I double-checked my work just now, the solution to this mess hit me. And it's shamefully simple. I have two controllers that use the same private function: 'view' calls it once, 'random' calls it 10 times. 'random' has its own jQuery tab; 'view' does not. Trouble is, $data['myval'] was defined in 'view' but not in 'random'. So for months -- literally months! -- I had myself believing that jQuery was causing PHP variables to die, since undefined variables only happened when jQuery was around.

D'oh. Big Grin


Messages In This Thread
jQuery Kills PHP Variables - by El Forum - 10-25-2008, 10:22 PM
jQuery Kills PHP Variables - by El Forum - 10-25-2008, 10:44 PM
jQuery Kills PHP Variables - by El Forum - 10-25-2008, 10:50 PM
jQuery Kills PHP Variables - by El Forum - 10-25-2008, 11:22 PM
jQuery Kills PHP Variables - by El Forum - 10-25-2008, 11:40 PM
jQuery Kills PHP Variables - by El Forum - 10-26-2008, 01:52 AM
jQuery Kills PHP Variables - by El Forum - 10-26-2008, 09:05 AM
jQuery Kills PHP Variables - by El Forum - 10-28-2008, 10:07 PM
jQuery Kills PHP Variables - by El Forum - 10-28-2008, 11:32 PM
jQuery Kills PHP Variables - by El Forum - 10-29-2008, 05:25 AM



Theme © iAndrew 2016 - Forum software by © MyBB