Solved

Json firefox not working, but IE ok.

Posted on 2009-05-14
9
1,004 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

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

Do you come here a lot? Are you lazy like me and don't want to go through the "trouble" of having to click your Dock's Safari icon and then having to click your Experts Exchange Favorites bookmark to get here? Well then this article is for you.
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
How to create a custom search shortcut to site-search Experts Exchange using Google in the Firefox browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…

690 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