[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
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 jwira...@gmail.com 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 kenshin...@gmail.com 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 jwira...@gmail.com 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 fictionalper...@gmail.com 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(); /* $('div class=items id=link_'+id+'/div').html ('a href='+url+''+title+'/a').appendTo('#page-wrap'); $(this).find('desc').each(function(){ var brief = $(this).find('brief').text(); var long = $(this).find('long').text(); $('div class=brief/div').html(brief).appendTo ('#link_'+id); $('div class=long/div').html(long).appendTo ('#link_'+id); }); */ alert(city) //}); } }); }); The XML file looks like this ?xml version=1.0 encoding=UTF-8? Response Ip74.125.45.100/Ip StatusOK/Status CountryCodeUS/CountryCode CountryNameUnited States/CountryName RegionCode06/RegionCode RegionNameCalifornia/RegionName CityMountain View/City ZipPostalCode94043/ZipPostalCode Latitude37.4192/Latitude Longitude-122.057/Longitude Timezone-8/Timezone Gmtoffset-8/Gmtoffset Dstoffset-7/Dstoffset /Response But I can't get it to pull the data out.
[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 jwira...@gmail.com 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(?xml version=\1.0\ encoding=\UTF-8\?); sb.Append(Response); sb.Append(Ip74.125.45.100/Ip); sb.Append(StatusOK/Status); sb.Append(CountryCodeUS/CountryCode); sb.Append(CountryNameUnited States/CountryName); sb.Append(RegionCode06/RegionCode); sb.Append(RegionNameCalifornia/RegionName); sb.Append(CityMountain View/City); sb.Append(ZipPostalCode94043/ZipPostalCode); sb.Append(Latitude37.4192/Latitude); sb.Append(Longitude-122.057/Longitude); sb.Append(Timezone-8/Timezone); sb.Append(Gmtoffset-8/Gmtoffset); sb.Append(Dstoffset-7/Dstoffset); sb.Append(/Response); Response.Clear(); Response.ContentType = text/xml; Response.Write(sb.ToString()); Response.End(); On Jan 8, 2:42 am, Frank Peterson fictionalper...@gmail.com 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 jwira...@gmail.com 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 kenshin...@gmail.com 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 jwira...@gmail.com 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 fictionalper...@gmail.com 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(); /* $('div class=items id=link_'+id+'/div').html ('a href='+url+''+title+'/a').appendTo('#page-wrap'); $(this).find('desc').each(function(){ var brief = $(this).find('brief').text(); var long = $(this).find('long').text(); $('div class=brief/div').html(brief).appendTo ('#link_'+id); $('div class=long/div').html(long).appendTo ('#link_'+id); }); */ alert(city) //}); } }); }); The XML file looks like this ?xml version=1.0 encoding=UTF-8? Response Ip74.125.45.100/Ip StatusOK/Status CountryCodeUS/CountryCode CountryNameUnited States/CountryName RegionCode06/RegionCode RegionNameCalifornia/RegionName CityMountain View/City ZipPostalCode94043/ZipPostalCode Latitude37.4192/Latitude Longitude-122.057/Longitude Timezone-8/Timezone Gmtoffset-8/Gmtoffset Dstoffset-7/Dstoffset /Response 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(); /* $('div class=items id=link_'+id+'/div').html ('a href='+url+''+title+'/a').appendTo('#page-wrap'); $(this).find('desc').each(function(){ var brief = $(this).find('brief').text(); var long = $(this).find('long').text(); $('div class=brief/div').html(brief).appendTo ('#link_'+id); $('div class=long/div').html(long).appendTo ('#link_'+id); }); */ alert(city) //}); } }); }); The XML file looks like this ?xml version=1.0 encoding=UTF-8? Response Ip74.125.45.100/Ip StatusOK/Status CountryCodeUS/CountryCode CountryNameUnited States/CountryName RegionCode06/RegionCode RegionNameCalifornia/RegionName CityMountain View/City ZipPostalCode94043/ZipPostalCode Latitude37.4192/Latitude Longitude-122.057/Longitude Timezone-8/Timezone Gmtoffset-8/Gmtoffset Dstoffset-7/Dstoffset /Response 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. !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=utf-8 / title/title script type=text/javascript src=../jquery.js/script script type=text/javascript src=../jquery.simplemodal-1.0.1.js/ script script type=text/javascript $(document).ready(function () { $('#basic').click(function (e) { e.preventDefault(); $('#basicModalContent').modal( { overlay: 75, close: false }); }); }); /script /head body form action=# method=post name=tester input type=button value=Submit name=basic id=basic / /form div id=basicModalContent style=display:noneYou should see this text/div /body /html
[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
Draggable for the UI has options, like GRID but there are no examples on how to use these options. Anyone know how?
[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] 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] 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] 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('div id=ajax_loadingloading/ div'); }, error: function(){ $('#video_ajax_gallery').append('Error loading data.'); }, success: function(msg){ $('#video_ajax_gallery').append('div id=video_gallery_container/div'); $('#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; }); } }); }