[jQuery] Re: Go through XML nodes only 1 level deep
I just checked the headers and they seem to be outputting correctly. Date: Fri, 08 Jan 2010 13:47:32 GMT Server: Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.6 with Suhosin-Patch mod_ruby/1.2.6 Ruby/1.8.6(2007-09-24) mod_ssl/2.2.8 OpenSSL/0.9.8g X-Powered-By: PHP/5.2.4-2ubuntu5.6 Content-Length: 454 Keep-Alive: timeout=15, max=98 Connection: Keep-Alive Content-Type: text/xml 200 OK
[jQuery] Re: Go through XML nodes only 1 level deep
Well the xml file is not on my server, but I'll try to shoot them an email and let them know, they should set the headers. On Jan 7, 4:44 pm, Jules wrote: > As suggested by Steven, set the ContentType to "text/xml". I don't > know how to do it in php, but here is the snipped from data source in > c# . > > StringBuilder sb = new StringBuilder(); > sb.Append(""); > sb.Append(""); > sb.Append("74.125.45.100"); > sb.Append("OK"); > sb.Append("US"); > sb.Append("United States"); > sb.Append("06"); > sb.Append("California"); > sb.Append("Mountain View"); > sb.Append("94043"); > sb.Append("37.4192"); > sb.Append("-122.057"); > sb.Append("-8"); > sb.Append("-8"); > sb.Append("-7"); > sb.Append(""); > > Response.Clear(); > Response.ContentType = "text/xml"; > Response.Write(sb.ToString()); > Response.End(); > > On Jan 8, 2:42 am, Frank Peterson wrote: > > > That works in IE8, but in FF 3.5.3 I get undefined in the alertbox. > > I've disabled adblock and flashblock, so its not those interfering. I > > dont get anything in the error console either. > > > The code I had posted earlier doesn't work in FF 3.53 either. I'm > > accessing it by running it on my desktop with this as the URL > > file:///c:/xampplite/htdocs/DEVELOPMENT/geolocate.htm > > but even when I access it via a decent URL I still get undefined in > > FFhttp://localhost/DEVELOPMENT/geolocate.htm > > > On Jan 6, 10:13 pm, Jules wrote: > > > > Ahah, too much stale eggnog. > > > > var option = { > > > error: function(request, status, error) { > > > alert(error); > > > }, > > > success: function(data, status) { > > > > var xml = $(data); > > > alert(xml.find('City').text()); > > > }, > > > dataType: "xml", > > > type: "GET", > > > url: "your url here" > > > }; > > > > $.ajax(option); > > > > This code works for me. > > > > On Jan 7, 2:50 pm, Steven Yang wrote: > > > > > just making sure > > > > > you are not able to parse the xml at all right? > > > > i believe for IE you have to make sure you server returns the correct > > > > content type like text/xml to client inorder for you to parse > > > > > hope this help > > > > > On Thu, Jan 7, 2010 at 9:30 AM, Jules wrote: > > > > > For some reason, it works on firefox (3.5.6) and doesn't work in ie > > > > > 6.0 and 8.0 > > > > > > On Jan 7, 6:39 am, Frank Peterson wrote: > > > > > > I'm grabbing an XML file with jQuery like this: > > > > > > > $(document).ready(function(){ > > > > > > $.ajax({ > > > > > > type: "GET", > > > > > > url: "http://ipinfodb.com/ip_query.php?ip=74.125.45.100";, > > > > > > dataType: "xml", > > > > > > success: function(xml) { > > > > > > //$(xml).find().each(function(){ > > > > > > var city = $(xml).find("City").text(); > > > > > > /* > > > > > > $('').html > > > > > > (''+title+'').appendTo('#page-wrap'); > > > > > > $(this).find('desc').each(function(){ > > > > > > var brief = $(this).find('brief').text(); > > > > > > var long = $(this).find('long').text(); > > > > > > $(' > > > > > class="brief">').html(brief).appendTo > > > > > > ('#link_'+id); > > > > > > $(' > > > > > class="long">').html(long).appendTo > > > > > > ('#link_'+id); > > > > > > }); > > > > > > */ > > > > > > alert(city) > > > > > > //}); > > > > > > } > > > > > > }); > > > > > > > }); > > > > > > > The XML file looks like this > > > > > > > > > > > > > > > > > > 74.125.45.100 > > > > > > OK > > > > > > US > > > > > > United States > > > > > > 06 > > > > > > California > > > > > > Mountain View > > > > > > 94043 > > > > > > 37.4192 > > > > > > -122.057 > > > > > > -8 > > > > > > -8 > > > > > > -7 > > > > > > > > > > > > > But I can't get it to pull the data out.
[jQuery] Re: Go through XML nodes only 1 level deep
That works in IE8, but in FF 3.5.3 I get undefined in the alertbox. I've disabled adblock and flashblock, so its not those interfering. I dont get anything in the error console either. The code I had posted earlier doesn't work in FF 3.53 either. I'm accessing it by running it on my desktop with this as the URL file:///c:/xampplite/htdocs/DEVELOPMENT/geolocate.htm but even when I access it via a decent URL I still get undefined in FF http://localhost/DEVELOPMENT/geolocate.htm On Jan 6, 10:13 pm, Jules wrote: > Ahah, too much stale eggnog. > > var option = { > error: function(request, status, error) { > alert(error); > }, > success: function(data, status) { > > var xml = $(data); > alert(xml.find('City').text()); > }, > dataType: "xml", > type: "GET", > url: "your url here" > }; > > $.ajax(option); > > This code works for me. > > On Jan 7, 2:50 pm, Steven Yang wrote: > > > just making sure > > > you are not able to parse the xml at all right? > > i believe for IE you have to make sure you server returns the correct > > content type like text/xml to client inorder for you to parse > > > hope this help > > > On Thu, Jan 7, 2010 at 9:30 AM, Jules wrote: > > > For some reason, it works on firefox (3.5.6) and doesn't work in ie > > > 6.0 and 8.0 > > > > On Jan 7, 6:39 am, Frank Peterson wrote: > > > > I'm grabbing an XML file with jQuery like this: > > > > > $(document).ready(function(){ > > > > $.ajax({ > > > > type: "GET", > > > > url: "http://ipinfodb.com/ip_query.php?ip=74.125.45.100";, > > > > dataType: "xml", > > > > success: function(xml) { > > > > //$(xml).find().each(function(){ > > > > var city = $(xml).find("City").text(); > > > > /* > > > > $('').html > > > > (''+title+'').appendTo('#page-wrap'); > > > > $(this).find('desc').each(function(){ > > > > var brief = $(this).find('brief').text(); > > > > var long = $(this).find('long').text(); > > > > $('').html(brief).appendTo > > > > ('#link_'+id); > > > > $('').html(long).appendTo > > > > ('#link_'+id); > > > > }); > > > > */ > > > > alert(city) > > > > //}); > > > > } > > > > }); > > > > > }); > > > > > The XML file looks like this > > > > > > > > > > > > 74.125.45.100 > > > > OK > > > > US > > > > United States > > > > 06 > > > > California > > > > Mountain View > > > > 94043 > > > > 37.4192 > > > > -122.057 > > > > -8 > > > > -8 > > > > -7 > > > > > > > > > But I can't get it to pull the data out.
[jQuery] Go through XML nodes only 1 level deep
I'm grabbing an XML file with jQuery like this: $(document).ready(function(){ $.ajax({ type: "GET", url: "http://ipinfodb.com/ip_query.php?ip=74.125.45.100";, dataType: "xml", success: function(xml) { //$(xml).find().each(function(){ var city = $(xml).find("City").text(); /* $('').html (''+title+'').appendTo('#page-wrap'); $(this).find('desc').each(function(){ var brief = $(this).find('brief').text(); var long = $(this).find('long').text(); $('').html(brief).appendTo ('#link_'+id); $('').html(long).appendTo ('#link_'+id); }); */ alert(city) //}); } }); }); The XML file looks like this 74.125.45.100 OK US United States 06 California Mountain View 94043 37.4192 -122.057 -8 -8 -7 But I can't get it to pull the data out.
[jQuery] SimpleModal Question
When I try to click a button with the SimpleModal Plugin it gives me the following error $('#basicModalContent').modal is not a function instead of showing the hidden div. http://www.w3.org/1999/xhtml";> $(document).ready(function () { $('#basic').click(function (e) { e.preventDefault(); $('#basicModalContent').modal( { overlay: "75", close: false }); }); }); You should see this text
[jQuery] Re: Is this valid JSON?
Thanks, I was wondering about those square brackets [ ] at the start and end, I had never seen JSON start with those before
[jQuery] Is this valid JSON?
[ { "ads": true, "content_slug": "just-some-title" } ]
[jQuery] jQuery UI - How do I get the X and Y of the DROP div
I'm using the example at: http://docs.jquery.com/UI/Droppables and I have the BLOCK dragging and able to drop it, but I want the BLOCK to take the X and Y position of the DROP div, I'm not sure how to find that out Also what are the ev, ui in the drop: function? Will UI give me the actual DROP div incase i have more than 1?
[jQuery] jQuery UI
Draggable for the UI has options, like GRID but there are no examples on how to use these options. Anyone know how?
[jQuery] Re: New jQuery Docs require more work to use
ok, thanks, i wasnt aware of what was planned, sounds cool. :) Until then I'll just use the history for the older version.
[jQuery] New jQuery Docs require more work to use
I noticed the docs changed, but now require more clicking than necessary. I liked the old docs which everything was on the page and it was faster to find things. Now I have to click on the area, then the function, then on CODE, HTML, RESULTS back and forth to get all the information.
[jQuery] Re: How to add content "here"?
It was on ajaxian awhile back, i cant find it but go through every article in the last 2 months and u should find it, please post it if you find it, i shoudl of bookmarked it :p http://ajaxian.com/
[jQuery] Re: How do you test if an object exists?
I'm not test for an ID or a HTML element but a variable. video_ajax_timer_id = setTimeout('prevnext(1, '+next_image_num+')', 5000); Basically I need to know if I need to call that setTimeout or not.
[jQuery] How do you test if an object exists?
I'm getting weird bugs when using setTimeouts and/or setIntervals after I hit the back button in Firefox to come back to the page. I need to do a check at the top of any setTimeout to make sure that the object I need still exists. But I dont know how :(
[jQuery] Re: Using back button causes C.easing[e.easing || (C.easing.swing ? "swing" : "linear")] is not a function
I'm using 1.1.4 before I was using 1.1.3.1 and I got this error: jQuery.easing[e.easing] is not a function But upgrading to the newest jQuery didnt fix the error instead it just changed what the error was Even though I still get errors but the script works, I just need to prevent Firefox from outputing those errors
[jQuery] Using back button causes C.easing[e.easing || (C.easing.swing ? "swing" : "linear")] is not a function
I am doing some ajax and calling a function every 5 seconds and it works perfect except when I press the back button and then gives this error on the next ajax load C.easing[e.easing || (C.easing.swing ? "swing" : "linear")] is not a function HERE IS MY CODE $(document).ready(function() { timer_set = 0; prevnext(); }); function prevnext() { //optional arguments, create the extra query string var next_param = (arguments[0]) ? '&next=' + arguments[0] : '&next=1'; var numsent_param = (arguments[1]) ? '&numsent=' + arguments[1] : ''; var extraparameters = next_param + numsent_param; $.ajaxSetup({timeout: 5000}); $.ajax({ type: 'POST', url: 'http://example.com/request.php', data: 'url=' + encodeURI('http://example.com/data.xml') + '&maxlength=' + encodeURI('3') + extraparameters, beforeSend: function() { if (timer_set) clearTimeout(video_ajax_timer_id); $('#video_ajax_gallery').empty(); $('#video_ajax_gallery').append('loading'); }, error: function(){ $('#video_ajax_gallery').append('Error loading data.'); }, success: function(msg){ $('#video_ajax_gallery').append(''); $('#video_gallery_container').append(msg); $('#video_gallery_container').fadeOut(1,function(){ $('#ajax_loading').hide(); }); $('#video_gallery_container').fadeIn('slow', function(){ video_ajax_timer_id = setTimeout("prevnext(1, next_video_num)", 5000);//next_video_num is set in response timer_set = 1; }); } }); }