Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Nov 2010

    WRT Preview alerting Error:0 for XMLHttpRequest req.send(null)

    Im a new in mobile development. Im using Visual Studio 2008 plugin and preview tool by default.
    I try to call XML file using ajax XMLHttpRequest(), everything is OK in Firefox and IE8. But in Preview tool throws alert with 'Error:0' I spend hours to debug it.
    the code in .js file:
    function init() 
        var url = "xmlNames.xml";
        ajaxFetch(url, "", XML_parsing_sequence, 1, 0);
        // retrieves data from server via ajax
        function ajaxFetch(url, param, callback, isXML, isPost) {
            var req = new XMLHttpRequest();
            req.onreadystatechange = function() {
                if (req.readyState == 4 && req.status == 200) {
                    if (isXML && req.responseXML != null) {
                    else {
                } else if (req.readyState == 4 && req.status != 200) {
                    // fetched the wrong page or network error...
                    var err = "Error: " + req.status;
            if (!isPost) 
                req.open("GET", url, true);
                // POST, doesn't work in the emulator!
                req.open("POST", url, true);
                req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        function XML_parsing_sequence(xmlFile) 
            function() {
                //Use the line below, if you have added an attribute to the XML file, e.g. <food id="1">
                //$("#output").append($(this).attr("id")+"<br />");
                //Add just one extra line in between each tag to form a list   
    .html file:
    HTML Code:
     <!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">
        <title>Sample Widget</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <link href="basic.css" rel="stylesheet" type="text/css" />
        <script type="text/javascript" src="jquery-1.4.2.min.js"></script>
        <script type="text/javascript" src="basic.js"></script>
        <meta name="generator" content="Nokia WRT extension for Visual Studio 2.0" />
    <body onload="init()">
        <div id="output" align="center">
     <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Nokia//DTD PLIST 1.0//EN" "http://www.nokia.com/DTDs/plist-1.0.dtd">
    <plist version="1.0">
    HTML Code:
    <?xml version="1.0" encoding="utf-8" ?>
        <name>Belgian Waffles</name>
          two of our famous Belgian Waffles with plenty of real maple syrup
        <name>Strawberry Belgian Waffles</name>
          light Belgian waffles covered with strawberries and whipped cream
        <name>Berry-Berry Belgian Waffles</name>
          light Belgian waffles covered with an assortment of fresh berries and whipped cream
        <name>French Toast</name>
          thick slices made from our homemade sourdough bread
        <name>Homestyle Breakfast</name>
          two eggs, bacon or sausage, toast, and our ever-popular hash browns
    attached screenshot

  2. #2
    Regular Contributor
    Join Date
    May 2009

    Re: WRT Preview alerting Error:0 for XMLHttpRequest req.send(null)

    add a line of code
    before your httpxmlrequest should solve your problem
    Nokia is back!

Similar Threads

  1. XMLHttpRequest status always returns NULL
    By vinothg in forum Symbian
    Replies: 6
    Last Post: 2009-09-22, 09:22
  2. m-send-req & m-retrieve-conf
    By tlindstr in forum General Messaging
    Replies: 2
    Last Post: 2003-06-27, 12:15
  3. M-send-req Pdu
    By fix78 in forum General Messaging
    Replies: 0
    Last Post: 2003-05-07, 16:31
  4. question about M-Send.req
    By homanshing in forum General Messaging
    Replies: 1
    Last Post: 2002-11-19, 05:24
  5. M-Send-Req message encoding
    By muralimohank in forum General Messaging
    Replies: 1
    Last Post: 2002-08-19, 05:56

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts