Re: [jQuery] xml response with $.get()

2006-12-21 Thread insq

Okay, let's leave that. 

Could someone point me in the right direction of parsing an XML file and
displaying its content using Jquery, without php?

Thanks in advance.
-- 
View this message in context: 
http://www.nabble.com/xml-response-with-%24.get%28%29-tf2848454.html#a8006025
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] xml response with $.get()

2006-12-20 Thread insq

I use Firefox 2.0.* and the latest jquery pack.

Using .html() instead of .text() does not work...

Any hints?
-- 
View this message in context: 
http://www.nabble.com/xml-response-with-%24.get%28%29-tf2848454.html#a7988849
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] xml response with $.get()

2006-12-20 Thread Erik Beeson

I've spent the past few hours fighting with exactly this type of problem. My
problem is using $.post or a comparable $.ajax call. It seems like there's
something wrong with the object getting passed to the callback. Any attempts
at getting at the data seems to make things just hang, in that, the browser
still responds and all, but my debug output statements stop appearing. I
have a callback like:

function(data) {
 alert(data); // shows XMLSomethingOrOther
 $('success',data).text(); // or .children() or .size()
 alert('made it'); // this never happens
}

Even replacing the $(..) call with $(data).filter(...) hangs. What's really
strange is even doing data.firstChild hangs. The returned xml is like:
successfoo/success

So I'm trying switching over to html instead of xml. Now my data looks like:
div class=successfoo/div

Now my data is getting returned properly, I can do
$(...).size()/.childre()/.tex(), but $('.success', data).size() still equals
0. Argh.

I'm I doing something majorly wrong, or is this stuff just not quite up to
par? I'm using jq1.0.4 with ff2 on winxp with firebug 0.4.1. Firebug
verifies that all of my data is getting sent and received properly, and that
the mime types are all correct.

--Erik

On 12/19/06, insq [EMAIL PROTECTED] wrote:



Hello there,

This may sound like a dumb question, but somehow I can't figure it out:

Let's say we have a basic xml file and a simple piece of code:

?xml version=1.0?
foo
  titleThis was loaded from an external XML file./title
/foo


$.get(ajax-test.xml,function(xml){
alert( $(title,xml).text() );
  });

This only works when put directly in $(document).ready(function() { }. I
can't receive any response using events (click etc.)

Firebug console notices a GET response as long as alert window
(unfortunately empty) is visible.


Thanks in advance.
--
View this message in context:
http://www.nabble.com/xml-response-with-%24.get%28%29-tf2848454.html#a7955113
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] xml response with $.get()

2006-12-20 Thread Jörn Zaefferer
 I use Firefox 2.0.* and the latest jquery pack.
 
 Using .html() instead of .text() does not work...


html() is a wrapper for the innerHTML property. That is not available for XML 
documents, therefore it doesn't work.

PS: I'm gonna check the docs for mentioning this.

--
Jörn Zaefferer

http://bassistance.de
-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] xml response with $.get()

2006-12-20 Thread Erik Beeson



Now my data is getting returned properly, I can do
$(...).size()/.childre()/.tex(), but $('.success', data).size() still equals
0. Argh.



This part at least was solved using an attribute selector for the class
attribute. This is working well enough, but dealing with XML is still
frustratingly difficult in jQuery where things are usually ridiculously
simple.

--Erik
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] xml response with $.get()

2006-12-20 Thread Dotan Dimet
Whenever you're puzzled why a certain line never gets executed, consider 
that your code might have thrown an exception and died.

I've found that wrapping the suspicious code with a try/catch block

 try{  } catch(e){ alert(e); }

is very helpful.

Especially when your code gets called by a link click or a form submit() 
event - the exception means your function doesn't return properly,

which means it doesn't return false, and the browser changes the 
document location, which might prevent the exception from showing up

in firebug or the javascript console.

- Dotan


Erik Beeson wrote:


 function(data) {
   alert(data); // shows XMLSomethingOrOther
   $('success',data).text(); // or .children() or .size()
   alert('made it'); // this never happens
 }




___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] xml response with $.get()

2006-12-20 Thread Erik Beeson

Thanks for the tip. I don't think of using try/catch in javascript. I'll
keep that in mind next time I'm having a problem.

--Erik

On 12/20/06, Dotan Dimet [EMAIL PROTECTED] wrote:


Whenever you're puzzled why a certain line never gets executed, consider
that your code might have thrown an exception and died.

I've found that wrapping the suspicious code with a try/catch block

try{  } catch(e){ alert(e); }

is very helpful.

Especially when your code gets called by a link click or a form submit()
event - the exception means your function doesn't return properly,

which means it doesn't return false, and the browser changes the
document location, which might prevent the exception from showing up

in firebug or the javascript console.

- Dotan


Erik Beeson wrote:


 function(data) {
   alert(data); // shows XMLSomethingOrOther
   $('success',data).text(); // or .children() or .size()
   alert('made it'); // this never happens
 }




___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] xml response with $.get()

2006-12-19 Thread Abdur-Rahman Advany
Hi,

What is your jquery version and browser (version)?

Abdul

insq wrote:
 Hello there,

 This may sound like a dumb question, but somehow I can't figure it out:

 Let's say we have a basic xml file and a simple piece of code:

 ?xml version=1.0?
 foo
   titleThis was loaded from an external XML file./title
 /foo


 $.get(ajax-test.xml,function(xml){
 alert( $(title,xml).text() );
   });

 This only works when put directly in $(document).ready(function() { }. I
 can't receive any response using events (click etc.) 

 Firebug console notices a GET response as long as alert window
 (unfortunately empty) is visible.


 Thanks in advance.
   


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] xml response with $.get()

2006-12-19 Thread Matt Stith

Im not sure, but try this:

$.get(ajax-test.xml,function(xml){
  alert( $(title,xml).html() );
});

Untested, blah blah blah.
On 12/19/06, insq [EMAIL PROTECTED] wrote:



Hello there,

This may sound like a dumb question, but somehow I can't figure it out:

Let's say we have a basic xml file and a simple piece of code:

?xml version=1.0?
foo
  titleThis was loaded from an external XML file./title
/foo


$.get(ajax-test.xml,function(xml){
alert( $(title,xml).text() );
  });

This only works when put directly in $(document).ready(function() { }. I
can't receive any response using events (click etc.)

Firebug console notices a GET response as long as alert window
(unfortunately empty) is visible.


Thanks in advance.
--
View this message in context:
http://www.nabble.com/xml-response-with-%24.get%28%29-tf2848454.html#a7955113
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/