[SOLVED] .append isn't working in IE6/7
Hi,
I am hoping someone will be able to help me, I am developing a website which incorporates a search function. Here is what happens:
1. Search Page Loads
2. jQuery retrieves Search Params from Form Fields
3. jQuery sends an AJAX request to a php script.
4. PHP script returns JSON back to jQuery
5. jQuery slideUp()'s then remove()'s the current content of the Search Results Div.
6. jQuery iterates through the JSON results, and Append()'s the new search results to the Search Results Div.
This process works fine in FF3, however in IE7 the Append calls do not work.
What is confusing me is that if the search doesn't return any results, I am appending a <p> tag to the same Search Results Div which contains the error message (which is contained in the JSON response). This works fine in all browsers, but when some results are returned it doesn't display the results.
The .append() is definately being called in IE7, as I put an Alert() in just before each call to Append().
My JS file is
here if you want to give it a read.
The only difference between the Appending of an ERROR and the Appending of a RESULT is that the RESULT is a more complicated string, incorporating variables etc.
Thanks for any help you can offer!
Cheers,
Dave C
---
Edit to Add:
If I try to append "<p>Oh Hai!</p>" instead of the result HTML, then it works fine so I assume it must be due to the complexity of the content I am trying to append.
---
Edit to Add:
I've sorted it - syntax error in my JS which I hadn't spotted. Specifically;
-
var innr = "<div id='"+id+"' class=\"views-row-1 views-row-odd views-row-first\">";
var innr = " <div class=\"node node-property-teaser\" id=\"node-78\">";
Redecalring the same variable, and therefore making the markup invalid.
Bloody typical, i've been trying to fix this for ages and as soon as I post for help I see the answer and embarass myself
