I have a piece of code that is working fine in IE, but it doesn’t run in Firefox. I think the problem is that I have not been able to implement $('document').ready(function). The structure of my json is like [{"options":"smart_exp"},{"options":"user_intf"},{"options":"blahblah"}]. I will be very thankful if someone can see my code & help me in correctly implementing it. Here is my code:
<html><head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2 /jquery.min.js"></script> <script type="text/javascript" language="javascript"> $(document).ready(function() { $.getJSON("http://127.0.0.1/conn_mysql.php", function (jsonData) { $.each(jsonData, function (i, j) { document.form1.fruits.options[i] = new Option(j.options); });}); }); </script></head> <body><form name="form1"> My favourite fruit is : <select name="fruits" id="fruits" /></form></body> </html>