Note that there are some explanatory texts on larger screens.

plurals
  1. POPhonegap ajax GET returning Internal Server Error
    primarykey
    data
    text
    <p>Im building an app with Phonegap and Backbone which parses an external XML feed. The feed is at:</p> <pre><code>http://cbccork.schoolspace.ie/index.php?option=com_ninjarsssyndicator&amp;feed_id=1&amp;format=raw </code></pre> <p>I fetch with:</p> <pre><code>var news = new model.NewsCollection(); news.fetch({ full_url: true, success: function (collection) { slider.slidePage(new NewsList({collection: collection}).$el); }, error: function (model, response, options) { console.log('statusText is '); console.log(response.statusText); console.log('responseText is '); console.log(response.responseText); }, }); </code></pre> <p>This works fine. However, the subdomain will be removed soon so the feed url will become:</p> <pre><code>http://cbccork.ie/index.php?option=com_ninjarsssyndicator&amp;feed_id=1&amp;format=raw </code></pre> <p>If you go to the urls you will see the output is the same xml (with <a href="http://cbccork.ie/" rel="nofollow">http://cbccork.ie/</a> instead of <a href="http://cbccork.schoolspace.ie/" rel="nofollow">http://cbccork.schoolspace.ie/</a>). </p> <p>However, when testing on an Android device, nothing is returned. I printed out the response which is:</p> <pre><code>Value of responseText is Value of responseXML is null Value of status is 500 Value of statusText is Internal Server Error </code></pre> <p>I have tested this in chrome (by disabling the same origin policy) and it works. But on any android device, it will not work.</p> <p>I have been trying to solve this for 3 days and am completely stumped. Any ideas? </p> <p><strong>EDIT</strong></p> <p>The news model and collection looks like this:</p> <pre><code>define(function (require) { "use strict"; var $ = require('jquery'), Backbone = require('backbone'), id=1, xml, parsed = [], title = "", description = "", pubDate = "", src="", img="", News = Backbone.Model.extend({ }), NewsCollection = Backbone.Collection.extend({ model: News, //url: 'http://www.test.webintelligence.ie/test/', url: 'http://www.cbccork.ie/index.php?option=com_ninjarsssyndicator&amp;feed_id=1&amp;format=raw', //This is used so I can test on a browser. On a device, use the direct link /* url: function(){ console.log('in news'); return "/school-proxy.php?type=news"; },*/ parse: function (data) { xml = data; $(xml).find('item').each(function (index) { img = $(description).find('img:first'); src = img.attr('src'); if(typeof(src)==='undefined' || src===null || src===""){ //so its null or undefined src = "img/crest.jpg"; } title = $(this).find('title').text(); description = $(this).find('description').text(); pubDate = $(this).find('pubDate').text(); pubDate = pubDate.substring(0, pubDate.length-12); parsed.push({id:id, title: title, description:description, pubDate:pubDate, src:src}); title, description, pubDate, src, img = ""; id++; }); return parsed; }, fetch: function (options) { options = options || {}; options.dataType = "xml"; return Backbone.Collection.prototype.fetch.call(this, options); } }); return { News: News, NewsCollection: NewsCollection }; }); </code></pre> <p><strong>EDIT:</strong></p> <p>I tried a direct Ajax call, but yet again I get an Internal Server Error on an Android device: </p> <pre><code> $.ajax({ url: "http://www.cbccork.ie/index.php?option=com_ninjarsssyndicator&amp;feed_id=1&amp;format=raw", }) .done(function( data ) { console.log( "Sample of data:", data ); }) .fail(function( jqXHR, textStatus, errorThrown ) { console.log('in the fail, textstatus is '); console.log(textStatus); console.log('error throwen is '); console.log(errorThrown); }); </code></pre> <p>Is there any way of solving this? I have tried everything...</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload