Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

JS jQuery Process xml?

Featured Replies

Unfortunately JS and jQuery, past the necessities has never been much of my strong point and I've hit a bit of a snag attempting to output the XML produced from the typical "REST service I made earlier", having tried a number of solutions I'm at my wits end...


A sample data set and example JS is below, though this would typically be returned based on the provided url, it seems any attempt to use a url or external XML file fail.

 

 

    $(document).ready(function()  
      {  
        $.get('http://localdev/books/course/CC150/xml', function(d){  
        $('body').append('<h1> Recommended Web Development Books </h1>');  
        $('body').append('<dl>');  
        $(d).find('book').each(function(){  
            var $book = $(this); 
			var id = $book.attr("id"); 
            var title = $book.attr("title");  
			var isbn = $book.attr("isbn");
			var borrowedcount = $book.attr("borrowedcount");
            var html = '<dd><p> ' + id + '</p>' ; 
			 html += '<p> ' + title + '</p>' ;  
			 html += '<p> ' + isbn + '</p>' ;  
			 html += '<p> ' + borrowedcount + '</p>' ;  
            html += '</dd>';  
            $('dl').append($(html));  
            $('.loadingPic').fadeOut(1400);  
        });  
    });  
});  

 


<?xml version="1.0" encoding="UTF-8"?>
<results>
  <course>CC150</course>
  <books>
    <book id="370955" title="Schaum's outline of UML" isbn="77096738" borrowedcount="212"/>
    <book id="422148" title="Human-computer interaction" isbn="130461091" borrowedcount="210"/>
    <book id="228015" title="Computer networks" isbn="133942481" borrowedcount="197"/>
     ..........
    </books>
</results>

Edited by CSN-UK

  • Author

Bit of an update for the benefit of those whom may in future experience a similar issue, It was DNS related, the localhost (LAMP/WAMP) server could not be found by $.get as it appeared to be querying the network DNS rather than considering the local DNS /localhost, thus returning a 404 file not found, works perfectly in a live environment however with the appropriate public URLs.

Edited by CSN-UK

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.