client = $("client",data).get(id);
I'd recommend putting a "var" in front so that you have a local, not a
global, variable.
It also seems to me like $("client",data).get(id) is equivalent to
'this' inside the each.
so instead of: client = $("client",data).get(id);
use: var client = this;
I've never tried to use jQuery with IE and XML data, so I'm not sure
what quirks might be caused by that combination.
I would recommend trying your function without the AJAX call:
var data = insert_your_xml_here;
$("client",data).each(function(id) {
client = $("client",data).get(id);
$("#left_items").append("<li id='"+$
("id",client).text()+"'><a
href='#'>"+$("name",client).text()+"</a></li>");
});
If none of that helps, I'd recommend installing Firebug, and doing
some heavy console logging ( http://getfirebug.com/console.html ),
specifically of the variable 'client'.
On Sep 30, 12:14 pm, "silk.odyssey" <silkodys...@gmail.com> wrote:
> I have the following code that works in firefox and google chrome
> using jquery 1.2.6.
>
> function setUpClient()
> {
> $.post("http://localhost/gestivov2/include/ajax/getclients.php", {},
> function(data){
> $('#left_items').empty();
> //alert(data);
> $("client",data).each(function(id) {
> client = $("client",data).get(id);
> $("#left_items").append("<li id='"+$("id",client).text()+"'><a
> href='#'>"+$("name",client).text()+"</a></li>");
> });
> })
>
> }
>
> It doesn't work with internet explorer 7, 8 beta nor 6. If I uncomment
> the alert code, the xml data gets displayed so it looks like the code
> within the each block is not being executed. What am i doing wrong?
No comments:
Post a Comment