[jQuery] Re: .ajax and ie7?

2008-11-30 Thread ricardobeat

I'll have to disagree with you. Using document.write for such a
trivial task is not the way to keep your code clean. I'm much more
into something like:

$.getJSON('readimages.php', {imagefolder: folderName, imageprefix:
imagePrefix}, function(images){
  $(images).each(function(){
 $(this).doSomething();
  });
});

And this could also be ran outside ready(), saving the result set in a
variable.

(if the 'random' parameter is not being used elsewhere in the script,
it could/should be generated server-side)

cheers,
- ricardo

On Nov 30, 3:12 am, Michael Geary [EMAIL PROTECTED] wrote:
 If the XML is really that simple, then the JSON format can be even simpler.
 Just use an array:

 [ onr_fc2.jpg, onr_fc2.jpg, onr_fc2.jpg, onr_fc2.jpg ]

 Then your code looks like:

   success: function( files ) {
      for( var i = 0;  i  files.length; ++i )
         do_something( files[i] );
   }

 As you can see, JSON is nothing more than the native JavaScript literal
 format for objects, arrays, and simpler data types such as strings and
 numbers. Because it is the native JavaScript format, there is no parsing
 required - the JavaScript interpreter already knows how to parse it, and you
 can access object properties and array elements directly.

 But here is a much better solution. Since you are loading this data file
 once when the page loads, simply have readimages.php generate a complete
 JavaScript statement:

 var imageList = [ onr_fc2.jpg, onr_fc2.jpg, onr_fc2.jpg, onr_fc2.jpg
 ];

 Then remove your $.ajax call from the $(document).ready() function, and
 replace this statement:

     var imageList = [];

 with:

     document.write(
         'script type=text/javascript src=readimages.php?',
             'imagefolder=', folderName, '',
             'imageprefix=', imagePrefix, '',
             'random=', Math.random()*9,
         '',
         '\/script'
     );

 Note that this code goes outside the $(document).ready() function. Where you
 have the var imageList = [] is a perfect place to put it.

 Then you will have your imageList filename array ready to use without any
 Ajax downloads or XML parsing. This will avoid any possibility of locking up
 the users's browser (and other browser windows) while the page loads. It's a
 lot simpler and better for the user too.

 -Mike



  From: Jeffrey Kretz

  Well, it was a bit of a pain to step through, as it was
  minimized jquery -- the full uncompressed version is much
  better for debugging.

  But as I stepped through, the success method did actually fire.

  The problem was that $(xml).find('file') did not return any results.

  I've never used jQuery to traverse XML nodes, so maybe
  someone else can help.  Here was the XML result I got:

  ?xml version=1.0 encoding=iso-8859-1? filelist
    fileonr_fc2.jpg/file
    fileonr_whd.jpg/file
    fileonr_lbp.jpg/file
    fileonr_egwt.jpg/file
    fileonr_mpr.jpg/file
    fileonr_fifa.jpg/file
    fileonr_waw.jpg/file
    fileonr_main.jpg/file
    fileonr_r2.jpg/file
  /filelist

  But as Mike said, json would be an easier way to do it.  The
  data would look something like this:

 [{file:'onr_fc2.jpg'},{file:'onr_fc2.jpg'},{file:'onr_fc2.jpg'},{file:'onr_f
 c2.jpg'}]



  jQuery would then use eval() to convert that into an array of
  objects.  Your success function would do something like this:

  success:function(files){
     for (var i=0;ifiles.length;i++)
     {
        do_something(files[i].file);
     }
  }

  JK

  -Original Message-
  From: jquery-en@googlegroups.com
  [mailto:[EMAIL PROTECTED] On Behalf Of David Andrews
  Sent: Saturday, November 29, 2008 7:25 PM
  To: jquery-en@googlegroups.com
  Subject: [jQuery] Re: .ajax and ie7?

  Thanks Mike and JK,

  A sample url is here..

 www.foobar.me.uk/test/example.htm

  To answer your questions:

  1. This does seem to be required as it loads the image names
  into an array which is then used to populate the image src in
  the DOM. If I leave async true then I get empty images for
  the first couple of transitions.

  2. Thanks for the tip on JSON - not familiar with it but will
  do some research - cheers.

  -

  If you open the above link in firefox then you will see some
  image transitions based on an array populated from my ajax
  request - in IE that array does not get populated as it looks
  like the ajax request is not getting called.

  Also - don't get me wrong I'm not anti IE - just asking! ;)

  Cheers
  Dave

  -Original Message-
  From: jquery-en@googlegroups.com
  [mailto:[EMAIL PROTECTED] On Behalf Of Michael Geary
  Sent: 30 November 2008 03:10
  To: jquery-en@googlegroups.com
  Subject: [jQuery] Re: .ajax and ie7?

  Of course Ajax works in IE. IE is the browser that invented
  Ajax (XMLHttpRequest)!

  Troubleshooting a code snippet is a lost cause. ;-) Can you
  post a link to a test page?

  A couple of tips, not directly related to the IE problem...

  async: false is an extreme measure that should

[jQuery] Re: .ajax and ie7?

2008-11-30 Thread Michael Geary
 29, 2008 7:25 PM
  To: jquery-en@googlegroups.com
  Subject: [jQuery] Re: .ajax and ie7?
  
  
  Thanks Mike and JK,
  
  A sample url is here.. 
  
  www.foobar.me.uk/test/example.htm
  
  To answer your questions: 
  
  1. This does seem to be required as it loads the image 
 names into an 
  array which is then used to populate the image src in the DOM. If I 
  leave async true then I get empty images for the first couple of 
  transitions.
  
  2. Thanks for the tip on JSON - not familiar with it but 
 will do some 
  research - cheers.
  
  -
  
  If you open the above link in firefox then you will see some image 
  transitions based on an array populated from my ajax 
 request - in IE 
  that array does not get populated as it looks like the ajax 
 request is 
  not getting called.
  
  Also - don't get me wrong I'm not anti IE - just asking! ;)
  
  Cheers
  Dave
  
  
  
  
  
  -Original Message-
  From: jquery-en@googlegroups.com
  [mailto:[EMAIL PROTECTED] On Behalf Of Michael Geary
  Sent: 30 November 2008 03:10
  To: jquery-en@googlegroups.com
  Subject: [jQuery] Re: .ajax and ie7?
  
  
  Of course Ajax works in IE. IE is the browser that invented Ajax 
  (XMLHttpRequest)!
  
  Troubleshooting a code snippet is a lost cause. ;-) Can you post a 
  link to a test page?
  
  A couple of tips, not directly related to the IE problem...
  
  async: false is an extreme measure that should be avoided 
 if possible. 
  It locks up the user interface of all browsers running in the same 
  thread. Do you have to do that?
  
  It sounds like you are in control of the PHP code that 
 generates the 
  XML, is that right? If so, you would be better off generating JSON 
  instead of XML.
  It's easier to work with JSON, and much faster too.
  
  -Mike
  
   From: David Andrews
   
   Hello all,
   
   I am using .ajax to populate an array via a PHP generated XML file
   
   //snip
   
   $.ajax({
 url : readimages.php,
 async : false,
 data : imagefolder= + folderName + imagePrefix= +
  imagePrefix,
 success : function(xml)
 {
  $(xml).find('file').each(function()
  {
 imageList.push($(this).text());
  });
 }
 });
   
   This works perfectly in FF but the success function does not get 
   called when run in IE7... should this code work ok or is 
 IE a lost 
   cause?
   
   Cheers
   Dave
  
  
 



[jQuery] Re: .ajax and ie7?

2008-11-29 Thread Jeffrey Kretz

Can you post a sample url?  The code below looks fine, don't see why it
would fail.

It would be easy to step through it with an IE script debugger to see what's
up.

JK

-Original Message-
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of David Andrews
Sent: Saturday, November 29, 2008 6:31 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] .ajax and ie7?


Hello all,

I am using .ajax to populate an array via a PHP generated XML file

//snip

$.ajax({
url : readimages.php,
async : false,
data : imagefolder= + folderName + imagePrefix= +
imagePrefix,
success : function(xml)
{
 $(xml).find('file').each(function()
 {
imageList.push($(this).text());
 });
}
});

This works perfectly in FF but the success function does not get called when
run in IE7... should this code work ok or is IE a lost cause?

Cheers
Dave






[jQuery] Re: .ajax and ie7?

2008-11-29 Thread Michael Geary

Of course Ajax works in IE. IE is the browser that invented Ajax
(XMLHttpRequest)!

Troubleshooting a code snippet is a lost cause. ;-) Can you post a link to a
test page?

A couple of tips, not directly related to the IE problem...

async: false is an extreme measure that should be avoided if possible. It
locks up the user interface of all browsers running in the same thread. Do
you have to do that?

It sounds like you are in control of the PHP code that generates the XML, is
that right? If so, you would be better off generating JSON instead of XML.
It's easier to work with JSON, and much faster too.

-Mike

 From: David Andrews
 
 Hello all,
 
 I am using .ajax to populate an array via a PHP generated XML file
 
 //snip
 
 $.ajax({
   url : readimages.php,
   async : false,
   data : imagefolder= + folderName + 
 imagePrefix= + imagePrefix,
   success : function(xml)
   {
$(xml).find('file').each(function()
{
   imageList.push($(this).text());
});
   }
   });
 
 This works perfectly in FF but the success function does not 
 get called when run in IE7... should this code work ok or is 
 IE a lost cause?
 
 Cheers
 Dave



[jQuery] Re: .ajax and ie7?

2008-11-29 Thread David Andrews

Thanks Mike and JK,

A sample url is here.. 

www.foobar.me.uk/test/example.htm

To answer your questions: 

1. This does seem to be required as it loads the image names into an array
which is then used to populate the image src in the DOM. If I leave async
true then I get empty images for the first couple of transitions.

2. Thanks for the tip on JSON - not familiar with it but will do some
research - cheers.

-

If you open the above link in firefox then you will see some image
transitions based on an array populated from my ajax request - in IE that
array does not get populated as it looks like the ajax request is not
getting called.

Also - don't get me wrong I'm not anti IE - just asking! ;)

Cheers
Dave





-Original Message-
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Michael Geary
Sent: 30 November 2008 03:10
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: .ajax and ie7?


Of course Ajax works in IE. IE is the browser that invented Ajax
(XMLHttpRequest)!

Troubleshooting a code snippet is a lost cause. ;-) Can you post a link to a
test page?

A couple of tips, not directly related to the IE problem...

async: false is an extreme measure that should be avoided if possible. It
locks up the user interface of all browsers running in the same thread. Do
you have to do that?

It sounds like you are in control of the PHP code that generates the XML, is
that right? If so, you would be better off generating JSON instead of XML.
It's easier to work with JSON, and much faster too.

-Mike

 From: David Andrews
 
 Hello all,
 
 I am using .ajax to populate an array via a PHP generated XML file
 
 //snip
 
 $.ajax({
   url : readimages.php,
   async : false,
   data : imagefolder= + folderName + imagePrefix= +
imagePrefix,
   success : function(xml)
   {
$(xml).find('file').each(function()
{
   imageList.push($(this).text());
});
   }
   });
 
 This works perfectly in FF but the success function does not get 
 called when run in IE7... should this code work ok or is IE a lost 
 cause?
 
 Cheers
 Dave



[jQuery] Re: .ajax and ie7?

2008-11-29 Thread Jeffrey Kretz

Well, it was a bit of a pain to step through, as it was minimized jquery --
the full uncompressed version is much better for debugging.

But as I stepped through, the success method did actually fire.

The problem was that $(xml).find('file') did not return any results.

I've never used jQuery to traverse XML nodes, so maybe someone else can
help.  Here was the XML result I got:

?xml version=1.0 encoding=iso-8859-1?
filelist
  fileonr_fc2.jpg/file
  fileonr_whd.jpg/file
  fileonr_lbp.jpg/file
  fileonr_egwt.jpg/file
  fileonr_mpr.jpg/file
  fileonr_fifa.jpg/file
  fileonr_waw.jpg/file
  fileonr_main.jpg/file
  fileonr_r2.jpg/file
/filelist

But as Mike said, json would be an easier way to do it.  The data would look
something like this:

[{file:'onr_fc2.jpg'},{file:'onr_fc2.jpg'},{file:'onr_fc2.jpg'},{file:'onr_f
c2.jpg'}]

jQuery would then use eval() to convert that into an array of objects.  Your
success function would do something like this:

success:function(files){
   for (var i=0;ifiles.length;i++)
   {
  do_something(files[i].file);
   }
}

JK

-Original Message-
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of David Andrews
Sent: Saturday, November 29, 2008 7:25 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: .ajax and ie7?


Thanks Mike and JK,

A sample url is here.. 

www.foobar.me.uk/test/example.htm

To answer your questions: 

1. This does seem to be required as it loads the image names into an array
which is then used to populate the image src in the DOM. If I leave async
true then I get empty images for the first couple of transitions.

2. Thanks for the tip on JSON - not familiar with it but will do some
research - cheers.

-

If you open the above link in firefox then you will see some image
transitions based on an array populated from my ajax request - in IE that
array does not get populated as it looks like the ajax request is not
getting called.

Also - don't get me wrong I'm not anti IE - just asking! ;)

Cheers
Dave





-Original Message-
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Michael Geary
Sent: 30 November 2008 03:10
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: .ajax and ie7?


Of course Ajax works in IE. IE is the browser that invented Ajax
(XMLHttpRequest)!

Troubleshooting a code snippet is a lost cause. ;-) Can you post a link to a
test page?

A couple of tips, not directly related to the IE problem...

async: false is an extreme measure that should be avoided if possible. It
locks up the user interface of all browsers running in the same thread. Do
you have to do that?

It sounds like you are in control of the PHP code that generates the XML, is
that right? If so, you would be better off generating JSON instead of XML.
It's easier to work with JSON, and much faster too.

-Mike

 From: David Andrews
 
 Hello all,
 
 I am using .ajax to populate an array via a PHP generated XML file
 
 //snip
 
 $.ajax({
   url : readimages.php,
   async : false,
   data : imagefolder= + folderName + imagePrefix= +
imagePrefix,
   success : function(xml)
   {
$(xml).find('file').each(function()
{
   imageList.push($(this).text());
});
   }
   });
 
 This works perfectly in FF but the success function does not get 
 called when run in IE7... should this code work ok or is IE a lost 
 cause?
 
 Cheers
 Dave




[jQuery] Re: .ajax and ie7?

2008-11-29 Thread David Andrews

Thanks JK, Sorry to push you through the min jquery but that was the version
I have on my live server.

Damn it - Embarrassed -  I will check why my XML is bad.

Sorry guys :(

I will also get myself a decent IE js debugger :)

Thanks again

Dave


-Original Message-
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Jeffrey Kretz
Sent: 30 November 2008 03:40
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: .ajax and ie7?


Well, it was a bit of a pain to step through, as it was minimized jquery --
the full uncompressed version is much better for debugging.

But as I stepped through, the success method did actually fire.

The problem was that $(xml).find('file') did not return any results.

I've never used jQuery to traverse XML nodes, so maybe someone else can
help.  Here was the XML result I got:

?xml version=1.0 encoding=iso-8859-1? filelist
  fileonr_fc2.jpg/file
  fileonr_whd.jpg/file
  fileonr_lbp.jpg/file
  fileonr_egwt.jpg/file
  fileonr_mpr.jpg/file
  fileonr_fifa.jpg/file
  fileonr_waw.jpg/file
  fileonr_main.jpg/file
  fileonr_r2.jpg/file
/filelist

But as Mike said, json would be an easier way to do it.  The data would look
something like this:

[{file:'onr_fc2.jpg'},{file:'onr_fc2.jpg'},{file:'onr_fc2.jpg'},{file:'onr_f
c2.jpg'}]

jQuery would then use eval() to convert that into an array of objects.  Your
success function would do something like this:

success:function(files){
   for (var i=0;ifiles.length;i++)
   {
  do_something(files[i].file);
   }
}

JK

-Original Message-
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of David Andrews
Sent: Saturday, November 29, 2008 7:25 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: .ajax and ie7?


Thanks Mike and JK,

A sample url is here.. 

www.foobar.me.uk/test/example.htm

To answer your questions: 

1. This does seem to be required as it loads the image names into an array
which is then used to populate the image src in the DOM. If I leave async
true then I get empty images for the first couple of transitions.

2. Thanks for the tip on JSON - not familiar with it but will do some
research - cheers.

-

If you open the above link in firefox then you will see some image
transitions based on an array populated from my ajax request - in IE that
array does not get populated as it looks like the ajax request is not
getting called.

Also - don't get me wrong I'm not anti IE - just asking! ;)

Cheers
Dave





-Original Message-
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Michael Geary
Sent: 30 November 2008 03:10
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: .ajax and ie7?


Of course Ajax works in IE. IE is the browser that invented Ajax
(XMLHttpRequest)!

Troubleshooting a code snippet is a lost cause. ;-) Can you post a link to a
test page?

A couple of tips, not directly related to the IE problem...

async: false is an extreme measure that should be avoided if possible. It
locks up the user interface of all browsers running in the same thread. Do
you have to do that?

It sounds like you are in control of the PHP code that generates the XML, is
that right? If so, you would be better off generating JSON instead of XML.
It's easier to work with JSON, and much faster too.

-Mike

 From: David Andrews
 
 Hello all,
 
 I am using .ajax to populate an array via a PHP generated XML file
 
 //snip
 
 $.ajax({
   url : readimages.php,
   async : false,
   data : imagefolder= + folderName + imagePrefix= +
imagePrefix,
   success : function(xml)
   {
$(xml).find('file').each(function()
{
   imageList.push($(this).text());
});
   }
   });
 
 This works perfectly in FF but the success function does not get 
 called when run in IE7... should this code work ok or is IE a lost 
 cause?
 
 Cheers
 Dave




[jQuery] Re: .ajax and ie7?

2008-11-29 Thread Jeffrey Kretz

This may be overkill for your needs, but it is free:

http://www.microsoft.com/express/vwd/

It also has jQuery-aware intellisense.

Whenever I need to debug an IE script page, I do ALT-V, U, O, pick the VS
Debugger and it opens right up with all the scripts available, can set
breakpoints, view variables and properties, etc. etc.

As much as I adore Firebug and can't live without it, its debugger is FAR
eclipsed by the Visual Studio one (IMO).

JK

-Original Message-
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of David Andrews
Sent: Saturday, November 29, 2008 7:50 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: .ajax and ie7?


Thanks JK, Sorry to push you through the min jquery but that was the version
I have on my live server.

Damn it - Embarrassed -  I will check why my XML is bad.

Sorry guys :(

I will also get myself a decent IE js debugger :)

Thanks again

Dave


-Original Message-
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Jeffrey Kretz
Sent: 30 November 2008 03:40
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: .ajax and ie7?


Well, it was a bit of a pain to step through, as it was minimized jquery --
the full uncompressed version is much better for debugging.

But as I stepped through, the success method did actually fire.

The problem was that $(xml).find('file') did not return any results.

I've never used jQuery to traverse XML nodes, so maybe someone else can
help.  Here was the XML result I got:

?xml version=1.0 encoding=iso-8859-1? filelist
  fileonr_fc2.jpg/file
  fileonr_whd.jpg/file
  fileonr_lbp.jpg/file
  fileonr_egwt.jpg/file
  fileonr_mpr.jpg/file
  fileonr_fifa.jpg/file
  fileonr_waw.jpg/file
  fileonr_main.jpg/file
  fileonr_r2.jpg/file
/filelist

But as Mike said, json would be an easier way to do it.  The data would look
something like this:

[{file:'onr_fc2.jpg'},{file:'onr_fc2.jpg'},{file:'onr_fc2.jpg'},{file:'onr_f
c2.jpg'}]

jQuery would then use eval() to convert that into an array of objects.  Your
success function would do something like this:

success:function(files){
   for (var i=0;ifiles.length;i++)
   {
  do_something(files[i].file);
   }
}

JK

-Original Message-
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of David Andrews
Sent: Saturday, November 29, 2008 7:25 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: .ajax and ie7?


Thanks Mike and JK,

A sample url is here.. 

www.foobar.me.uk/test/example.htm

To answer your questions: 

1. This does seem to be required as it loads the image names into an array
which is then used to populate the image src in the DOM. If I leave async
true then I get empty images for the first couple of transitions.

2. Thanks for the tip on JSON - not familiar with it but will do some
research - cheers.

-

If you open the above link in firefox then you will see some image
transitions based on an array populated from my ajax request - in IE that
array does not get populated as it looks like the ajax request is not
getting called.

Also - don't get me wrong I'm not anti IE - just asking! ;)

Cheers
Dave





-Original Message-
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Michael Geary
Sent: 30 November 2008 03:10
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: .ajax and ie7?


Of course Ajax works in IE. IE is the browser that invented Ajax
(XMLHttpRequest)!

Troubleshooting a code snippet is a lost cause. ;-) Can you post a link to a
test page?

A couple of tips, not directly related to the IE problem...

async: false is an extreme measure that should be avoided if possible. It
locks up the user interface of all browsers running in the same thread. Do
you have to do that?

It sounds like you are in control of the PHP code that generates the XML, is
that right? If so, you would be better off generating JSON instead of XML.
It's easier to work with JSON, and much faster too.

-Mike

 From: David Andrews
 
 Hello all,
 
 I am using .ajax to populate an array via a PHP generated XML file
 
 //snip
 
 $.ajax({
   url : readimages.php,
   async : false,
   data : imagefolder= + folderName + imagePrefix= +
imagePrefix,
   success : function(xml)
   {
$(xml).find('file').each(function()
{
   imageList.push($(this).text());
});
   }
   });
 
 This works perfectly in FF but the success function does not get 
 called when run in IE7... should this code work ok or is IE a lost 
 cause?
 
 Cheers
 Dave





[jQuery] Re: .ajax and ie7?

2008-11-29 Thread Uwe C. Schroeder


On Saturday 29 November 2008, Jeffrey Kretz wrote:
 This may be overkill for your needs, but it is free:

 http://www.microsoft.com/express/vwd/

 It also has jQuery-aware intellisense.

 Whenever I need to debug an IE script page, I do ALT-V, U, O, pick the VS
 Debugger and it opens right up with all the scripts available, can set
 breakpoints, view variables and properties, etc. etc.

 As much as I adore Firebug and can't live without it, its debugger is FAR
 eclipsed by the Visual Studio one (IMO).


Thanks for that link. I was just going to ask if there even is a half way 
decent debugger for IE.  Windows is so unwieldy when it comes to debugging 
(but that may just be me, as using Windows is a pain for me and I only do 
when there's absolutely no way around it...)

Personally I write my stuff for Firefox (or better standards compliant - 
where firefox has it's issues every now and then, but far less than IE). Once 
all that works I start to degrade it to IE7. On all websites where I can make 
the decision (non-client websites), I don't even support IE6. Hey, if you use 
that old piece of crap you don't deserve visiting my website.
The only thing I do for those guys is give them the download links to IE7, 
FF,Safari or Chrome.



[jQuery] Re: .ajax and ie7?

2008-11-29 Thread Jeffrey Kretz

I understand where you're coming from, but I need to support a broader
user-base for my software.

I have two virtual machines on my main PC with XP and Vista installed, and a
separate Macbook Pro, so that I can cross-check compatibility between IE6
XP, IE7 XP, IE7 Vista, FF2, FF3, Opera, Safari Win, Safari Mac, FF Mac and
Chrome.

The javascript is occasionally an issue, but complex CSS-based layouts can
be a pain.

At this point my production flow is grooved in enough that I rarely have
issues.

JK

-Original Message-
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Uwe C. Schroeder
Sent: Saturday, November 29, 2008 8:04 PM
To: jquery-en@googlegroups.com
Cc: Jeffrey Kretz
Subject: [jQuery] Re: .ajax and ie7?



On Saturday 29 November 2008, Jeffrey Kretz wrote:
 This may be overkill for your needs, but it is free:

 http://www.microsoft.com/express/vwd/

 It also has jQuery-aware intellisense.

 Whenever I need to debug an IE script page, I do ALT-V, U, O, pick the VS
 Debugger and it opens right up with all the scripts available, can set
 breakpoints, view variables and properties, etc. etc.

 As much as I adore Firebug and can't live without it, its debugger is FAR
 eclipsed by the Visual Studio one (IMO).


Thanks for that link. I was just going to ask if there even is a half way 
decent debugger for IE.  Windows is so unwieldy when it comes to debugging 
(but that may just be me, as using Windows is a pain for me and I only do 
when there's absolutely no way around it...)

Personally I write my stuff for Firefox (or better standards compliant - 
where firefox has it's issues every now and then, but far less than IE).
Once 
all that works I start to degrade it to IE7. On all websites where I can
make 
the decision (non-client websites), I don't even support IE6. Hey, if you
use 
that old piece of crap you don't deserve visiting my website.
The only thing I do for those guys is give them the download links to IE7, 
FF,Safari or Chrome.




[jQuery] Re: .ajax and ie7?

2008-11-29 Thread Michael Geary

If the XML is really that simple, then the JSON format can be even simpler.
Just use an array:

[ onr_fc2.jpg, onr_fc2.jpg, onr_fc2.jpg, onr_fc2.jpg ]

Then your code looks like:

  success: function( files ) {
 for( var i = 0;  i  files.length; ++i )
do_something( files[i] );
  }

As you can see, JSON is nothing more than the native JavaScript literal
format for objects, arrays, and simpler data types such as strings and
numbers. Because it is the native JavaScript format, there is no parsing
required - the JavaScript interpreter already knows how to parse it, and you
can access object properties and array elements directly.

But here is a much better solution. Since you are loading this data file
once when the page loads, simply have readimages.php generate a complete
JavaScript statement:

var imageList = [ onr_fc2.jpg, onr_fc2.jpg, onr_fc2.jpg, onr_fc2.jpg
];

Then remove your $.ajax call from the $(document).ready() function, and
replace this statement:

var imageList = [];

with:

document.write(
'script type=text/javascript src=readimages.php?',
'imagefolder=', folderName, '',
'imageprefix=', imagePrefix, '',
'random=', Math.random()*9,
'',
'\/script'
);

Note that this code goes outside the $(document).ready() function. Where you
have the var imageList = [] is a perfect place to put it.

Then you will have your imageList filename array ready to use without any
Ajax downloads or XML parsing. This will avoid any possibility of locking up
the users's browser (and other browser windows) while the page loads. It's a
lot simpler and better for the user too.

-Mike

 From: Jeffrey Kretz
 
 Well, it was a bit of a pain to step through, as it was 
 minimized jquery -- the full uncompressed version is much 
 better for debugging.
 
 But as I stepped through, the success method did actually fire.
 
 The problem was that $(xml).find('file') did not return any results.
 
 I've never used jQuery to traverse XML nodes, so maybe 
 someone else can help.  Here was the XML result I got:
 
 ?xml version=1.0 encoding=iso-8859-1? filelist
   fileonr_fc2.jpg/file
   fileonr_whd.jpg/file
   fileonr_lbp.jpg/file
   fileonr_egwt.jpg/file
   fileonr_mpr.jpg/file
   fileonr_fifa.jpg/file
   fileonr_waw.jpg/file
   fileonr_main.jpg/file
   fileonr_r2.jpg/file
 /filelist
 
 But as Mike said, json would be an easier way to do it.  The 
 data would look something like this:
 

[{file:'onr_fc2.jpg'},{file:'onr_fc2.jpg'},{file:'onr_fc2.jpg'},{file:'onr_f
c2.jpg'}]
 
 jQuery would then use eval() to convert that into an array of 
 objects.  Your success function would do something like this:
 
 success:function(files){
for (var i=0;ifiles.length;i++)
{
   do_something(files[i].file);
}
 }
 
 JK
 
 -Original Message-
 From: jquery-en@googlegroups.com 
 [mailto:[EMAIL PROTECTED] On Behalf Of David Andrews
 Sent: Saturday, November 29, 2008 7:25 PM
 To: jquery-en@googlegroups.com
 Subject: [jQuery] Re: .ajax and ie7?
 
 
 Thanks Mike and JK,
 
 A sample url is here.. 
 
 www.foobar.me.uk/test/example.htm
 
 To answer your questions: 
 
 1. This does seem to be required as it loads the image names 
 into an array which is then used to populate the image src in 
 the DOM. If I leave async true then I get empty images for 
 the first couple of transitions.
 
 2. Thanks for the tip on JSON - not familiar with it but will 
 do some research - cheers.
 
 -
 
 If you open the above link in firefox then you will see some 
 image transitions based on an array populated from my ajax 
 request - in IE that array does not get populated as it looks 
 like the ajax request is not getting called.
 
 Also - don't get me wrong I'm not anti IE - just asking! ;)
 
 Cheers
 Dave
 
 
 
 
 
 -Original Message-
 From: jquery-en@googlegroups.com 
 [mailto:[EMAIL PROTECTED] On Behalf Of Michael Geary
 Sent: 30 November 2008 03:10
 To: jquery-en@googlegroups.com
 Subject: [jQuery] Re: .ajax and ie7?
 
 
 Of course Ajax works in IE. IE is the browser that invented 
 Ajax (XMLHttpRequest)!
 
 Troubleshooting a code snippet is a lost cause. ;-) Can you 
 post a link to a test page?
 
 A couple of tips, not directly related to the IE problem...
 
 async: false is an extreme measure that should be avoided if 
 possible. It locks up the user interface of all browsers 
 running in the same thread. Do you have to do that?
 
 It sounds like you are in control of the PHP code that 
 generates the XML, is that right? If so, you would be better 
 off generating JSON instead of XML.
 It's easier to work with JSON, and much faster too.
 
 -Mike
 
  From: David Andrews
  
  Hello all,
  
  I am using .ajax to populate an array via a PHP generated XML file
  
  //snip
  
  $.ajax({
  url : readimages.php,
  async : false,
  data : imagefolder= + folderName + imagePrefix= +
 imagePrefix,
  success

[jQuery] Re: .ajax and ie7?

2008-11-29 Thread David Andrews

Thanks Mike - although it seems a little complicated to me at first sight
(I'm not a java developer) - I'm sure I will get my head round it! One more
cup of coffee! :)

For those that are interested My XML was failing due to the content type of
the document not being correctly set - added

header(Content-type: text/xml); 

to my PHP generated file and now everything works as it should..  5 hours of
my life I won't get back. :(

I will have another look at your suggestion below once I have had some sleep
- is 5:22 am here.. 

Good night everyone and thanks for your help!

:)

Dave 



-Original Message-
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Michael Geary
Sent: 30 November 2008 05:12
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: .ajax and ie7?


If the XML is really that simple, then the JSON format can be even simpler.
Just use an array:

[ onr_fc2.jpg, onr_fc2.jpg, onr_fc2.jpg, onr_fc2.jpg ]

Then your code looks like:

  success: function( files ) {
 for( var i = 0;  i  files.length; ++i )
do_something( files[i] );
  }

As you can see, JSON is nothing more than the native JavaScript literal
format for objects, arrays, and simpler data types such as strings and
numbers. Because it is the native JavaScript format, there is no parsing
required - the JavaScript interpreter already knows how to parse it, and you
can access object properties and array elements directly.

But here is a much better solution. Since you are loading this data file
once when the page loads, simply have readimages.php generate a complete
JavaScript statement:

var imageList = [ onr_fc2.jpg, onr_fc2.jpg, onr_fc2.jpg, onr_fc2.jpg
];

Then remove your $.ajax call from the $(document).ready() function, and
replace this statement:

var imageList = [];

with:

document.write(
'script type=text/javascript src=readimages.php?',
'imagefolder=', folderName, '',
'imageprefix=', imagePrefix, '',
'random=', Math.random()*9,
'',
'\/script'
);

Note that this code goes outside the $(document).ready() function. Where you
have the var imageList = [] is a perfect place to put it.

Then you will have your imageList filename array ready to use without any
Ajax downloads or XML parsing. This will avoid any possibility of locking up
the users's browser (and other browser windows) while the page loads. It's a
lot simpler and better for the user too.

-Mike

 From: Jeffrey Kretz
 
 Well, it was a bit of a pain to step through, as it was minimized 
 jquery -- the full uncompressed version is much better for debugging.
 
 But as I stepped through, the success method did actually fire.
 
 The problem was that $(xml).find('file') did not return any results.
 
 I've never used jQuery to traverse XML nodes, so maybe someone else 
 can help.  Here was the XML result I got:
 
 ?xml version=1.0 encoding=iso-8859-1? filelist
   fileonr_fc2.jpg/file
   fileonr_whd.jpg/file
   fileonr_lbp.jpg/file
   fileonr_egwt.jpg/file
   fileonr_mpr.jpg/file
   fileonr_fifa.jpg/file
   fileonr_waw.jpg/file
   fileonr_main.jpg/file
   fileonr_r2.jpg/file
 /filelist
 
 But as Mike said, json would be an easier way to do it.  The data 
 would look something like this:
 

[{file:'onr_fc2.jpg'},{file:'onr_fc2.jpg'},{file:'onr_fc2.jpg'},{file:'onr_f
c2.jpg'}]
 
 jQuery would then use eval() to convert that into an array of objects.  
 Your success function would do something like this:
 
 success:function(files){
for (var i=0;ifiles.length;i++)
{
   do_something(files[i].file);
}
 }
 
 JK
 
 -Original Message-
 From: jquery-en@googlegroups.com
 [mailto:[EMAIL PROTECTED] On Behalf Of David Andrews
 Sent: Saturday, November 29, 2008 7:25 PM
 To: jquery-en@googlegroups.com
 Subject: [jQuery] Re: .ajax and ie7?
 
 
 Thanks Mike and JK,
 
 A sample url is here.. 
 
 www.foobar.me.uk/test/example.htm
 
 To answer your questions: 
 
 1. This does seem to be required as it loads the image names into an 
 array which is then used to populate the image src in the DOM. If I 
 leave async true then I get empty images for the first couple of 
 transitions.
 
 2. Thanks for the tip on JSON - not familiar with it but will do some 
 research - cheers.
 
 -
 
 If you open the above link in firefox then you will see some image 
 transitions based on an array populated from my ajax request - in IE 
 that array does not get populated as it looks like the ajax request is 
 not getting called.
 
 Also - don't get me wrong I'm not anti IE - just asking! ;)
 
 Cheers
 Dave
 
 
 
 
 
 -Original Message-
 From: jquery-en@googlegroups.com
 [mailto:[EMAIL PROTECTED] On Behalf Of Michael Geary
 Sent: 30 November 2008 03:10
 To: jquery-en@googlegroups.com
 Subject: [jQuery] Re: .ajax and ie7?
 
 
 Of course Ajax works in IE. IE is the browser that invented Ajax 
 (XMLHttpRequest)!
 
 Troubleshooting a code snippet is a lost cause. ;-) Can you