Solved

Json firefox not working, but IE ok.

Posted on 2009-05-14
9
1,001 Views
Last Modified: 2013-12-08
Hi - I have some php code that outputs 4 variables as "yes" or "no", which is called from submitting a form. I'm echoing this as an array and an ajax script is picking it up via a json output.

This works fine in IE, i.e. the script finds the ajax response and processes fine. But in firefox, it stops at the ajax response and I just see the array echoed in the browser as {"var1":"no","var2":"no","var3":"no","var4":"no"}  and nothing happens.

Any ideas?
$myArray = array(
     'var1' => $var1,
     'var2' => $var2, 
	 'var3' => $var3,
	 'var4' => $var4 
); 
 
echo json_encode($myArray);

Open in new window

register.txt
ajax-register.txt
0
Comment
Question by:michaelbrewitt
  • 4
  • 3
9 Comments
 
LVL 1

Author Comment

by:michaelbrewitt
ID: 24390548
Sorry, I forgot to mention, the above works in Firefox if I access /register.php directly. But, loading register/php through a <div>, it breaks as described above.
0
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 24414907
Please post the Javascript part of the AJAX code in a snippet.  Also the html for the part of the page the script works with.
bol
0
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 24414915
Could you also look and see if you get a Javascript error in Firefox when you try this?  Provide details if you are getting an error.
bol
0
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
LVL 1

Author Comment

by:michaelbrewitt
ID: 24425226
See attached.

Index page loads and first loads the login.php file into a div. If you click on "register" it then loads register.php as attached above.

Incidently, I can get this working fine with the login.php file - it's just the register version which doesn't work.

No errors in firefox/firebug.

Many thanks
index.txt
login.txt
0
 
LVL 1

Accepted Solution

by:
michaelbrewitt earned 0 total points
ID: 24446463
Got it! I removed the $(document).ready() enclosure and bingo, all working fine!
0
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 24446594
Great!  Thanks for letting me know.   Since I was still just getting attached files I had hesitated to look into this more (I am more cautious about what I download than just what I see in a snippet).
Had you sent me the email with the URL and other info?  I got one but didn't get a URL for the EE question.  I am pretty sure it was you and this one but please confirm.
bol
0
 
LVL 1

Author Comment

by:michaelbrewitt
ID: 24453902
Yes, I sent you an email with the URL.
Glad it's working now, spent way too much time trying to sort it. Thanks for taking the time to have a look.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
Several part series to implement Internet Explorer 11 Enterprise Mode
This Micro Tutorial will demonstrate how nuggets on the Web are formatted by using Chrome Developer Tools. These tools would not only view the site's CSS but it can also modify it and save the CSS to use on your own site.
Shows how to create a shortcut to site-search Experts Exchange using Google in the Chrome browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch the Search Engine Menu: In chrome, via you…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question