0

I know I'm not the first one to get the problem, but couldn't get clue from the google search.

Here is my code:

$.get(
  "my.php", //xml file will be back
  function(data){

    var dataXml = data;

    var listV = dataXml.getElementsByTagName("ver");

    var html = "<tr>";
    html += "Version<select name='version' id='verList'>";
    //....get data from the xml file, codes was ignored for brief
    html += "</select>";
    html += "MacAddress <input id=\"macInput\" type=\"text\" name=\"MacInput\" />";
    html += "</tr>";

    $("#optionPanel").append(html);

    var sybutton = $('<button id="queryB" class="queryB"   type="submit">Submit</button>').click(function(){...}

    $("#optionPanel tr:last").append(sybutton);

The picture is: a selection list + Mac input + a button to submit the query.

The codes are working well on my Firefox with Ubuntu. But on Macbook's FF or Safari, only the button is displayed, but not for the selection list and Mac input which were gone totaly. Any idea? thanks in advance.

I use below to get Javascript and JQuery.

<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>

Oh, I forgot one point. In the error console from FF, I could see:

Error: installStatus is null
browser.js   Line: 10417

I opened the file and the line is in an event reporting function which tried to report "PluginNotFound" error(???).

The AJAX of JQuery was working because I saw the traffic in Wireshark.

S..
  • 5,511
  • 2
  • 36
  • 43
Yang
  • 1,285
  • 1
  • 10
  • 14

1 Answers1

1

just a guess because therez only one non jquery pure js function used change

var listV = dataXml.getElementsByTagName("ver");

to

var listV = $(dataXml).find("ver");
Parv Sharma
  • 12,581
  • 4
  • 48
  • 80
  • Good guessing, but not working. Though it doesn't work, I think it's some direction I should look more. I'm also thinking it could be something about the objects between JavaScript and JQuery. I also tried to only add the "input" in which would be not including the using of listV, didn't work either. – Yang Jul 11 '12 at 07:00
  • I guess something about $("#optionPanel").append(html). Because 'button' can always be appended. – Yang Jul 11 '12 at 07:09
  • try $("#optionPanel").append($(html)). – Parv Sharma Jul 11 '12 at 07:11
  • I found a solution. change: "$("#optionPanel").append(html);" to: "document.getElementById("optionPanel").innerHTML = html;" Then I need to change "$("#optionPanel tr:last").append(sybutton);" to "$("#optionPanel").append(sybutton);" It's working. I still want to know the root cause. It's interesting one. – Yang Jul 11 '12 at 07:29
  • did you try doing this $("#optionPanel").append($(html)) – Parv Sharma Jul 11 '12 at 07:31