Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7040651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:56:37+00:00 2026-05-28T01:56:37+00:00

In my PhoneGap Eclipse project I am using jQuery for visual effects by referencing

  • 0

In my PhoneGap Eclipse project I am using jQuery for visual effects by referencing jQuery libraries:

   <link rel="stylesheet"
        href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.css" />
    <script type="text/javascript" src="http://code.jquery.com/jquery.js"></script>
    <script type="text/javascript"
        src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.js"></script>

and I am also making remote domain requests in order to display some information from the remote server.

1: When I make requests to multiple servers, I get an error saying:

DroidGap: TIMEOUT ERROR! – calling webViewClient

I read that I must alter my Phonegaps whitelist by doing:

<phonegap>
    <access origin="\*\" /> 
</phonegap>

Source: GitHub call-back

But I get some error, so I have decided to approach same results from the different ways:

2: <script type="text/javascript" src="file:///android_asset/js/jquery.js"></script>

<script type="text/javascript" src="../js/jquery.js"></script>

Why? – because i would like to avoid getting errors with multiple-domain requests

In these cases I get an error

SyntaxError: Parse error at file:///… in logcat

I have no idea why this is happening, because the specified file location supposed to be right in both cases.

So my questions are:

  • Why I cannot include .js file in this way?
  • Which solution I should continue trying to approach (1 or 2)?

structure

<html>
<head>
<title></title>
<script src="phonegap-1.3.0.js"></script>

<link rel="stylesheet" href="jquery.mobile-1.0.css" />
<script type="text/javascript" src="jquery.mobile-1.0.js"></script>
<script type="text/javascript" src="jquery.js"></script>

<!-- 
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
 <link rel="stylesheet" href="lib/touch/resources/css/sencha-touch.css" type="text/css">
     <script type="text/javascript" src="lib/touch/sencha-touch.js"></script>
     <!-- <script type="text/javascript" src="lib/touch/index.js"></script>  -->

<script>
    var alreadyrunflag = 0 //flag to indicate whether target function has already been run
    var url = "http://www.norwegian.no/";

    var currentTime = new Date();
    var month = currentTime.getMonth() + 1;
    var year = currentTime.getFullYear();

    //on page loaded
    if (document.addEventListener)
        document.addEventListener("DOMContentLoaded", function() {
            //alreadyrunflag = 1;
            initGet(url);
        }, false)
    else if (document.all && !window.opera) {
        //page load error?
    }

    function applyChangeEvent() {
        //on selection changed
        var selectDepart = document.getElementById("depart");
        var selectArrive = document.getElementById("arrive");

        selectDepart.onchange = function() { //run some code when "onchange" event fires
            if (document.getElementsByTagName("select")[1].options[document
                    .getElementsByTagName("select")[1].options.selectedIndex].value != ""
                    && document.getElementsByTagName("select")[0].options[document
                            .getElementsByTagName("select")[0].options.selectedIndex].value != "") {
                for ( var monthsCount = 1; monthsCount < 13; monthsCount++) {
                    //alert(monthsCount);
                    get("http://www.norwegian.no/fly/lavpris/", monthsCount);
                }
            }
        }

        selectArrive.onchange = function() { //run some code when "onchange" event fires
            if (document.getElementsByTagName("select")[1].options[document
                    .getElementsByTagName("select")[1].options.selectedIndex].value != ""
                    && document.getElementsByTagName("select")[0].options[document
                            .getElementsByTagName("select")[0].options.selectedIndex].value != "") {
                for ( var monthsCount = 1; monthsCount < 13; monthsCount++) {
                    //alert(monthsCount);
                    get("http://www.norwegian.no/fly/lavpris/", monthsCount);
                }
            }
        }
    }

    function initGet(url) {
        var request = new XMLHttpRequest();
        request.open("GET", url, true);
        request.onreadystatechange = function() {
            if (request.readyState == 4) {
                if (request.status == 200 || request.status == 0) {
                    //request.responseText
                    getObjs(request.responseText);
                }
            }
        }
        request.send();
    }

    function get(url, month) {
        //alert(month);

        url += "?D_City="
                + document.getElementsByTagName("select")[0].options[document
                        .getElementsByTagName("select")[0].options.selectedIndex].value;
        url += "&A_City="
                + document.getElementsByTagName("select")[1].options[document
                        .getElementsByTagName("select")[1].options.selectedIndex].value;
        url += "&TripType=1";
        url += "&D_Day=1";
        url += "&D_Month=" + getMonth(month);
        /* url += "&R_Day=1";
        url += "&R_Month=201201"; */
        url += "&AdultCount=1";
        url += "&ChildCount=0";
        url += "&InfantCount=0";

        //alert(url);

        var request = new XMLHttpRequest();
        request.open("GET", url, true);
        request.onreadystatechange = function() {
            if (request.readyState == 4) {
                if (request.status == 200 || request.status == 0) {
                    //request.responseText
                    parse(request.responseText, month);
                }
            }
        }
        request.send();
    }

    function getMonth(month) {
        //alert(month.toString.length + " | " + month);
        if (month.toString().length == 1) {
            var tempMonth = "0" + month.toString();
            //alert(tempMonth);
            return year.toString() + tempMonth;
        } else
            return year.toString() + month;
    }

    function getSimpleMonth() {
        return month;
    }

    function getObjs(mainPageHtml) {
        var mainDoc = (new DOMParser()).parseFromString(mainPageHtml,
                "application/xhtml+xml");

        var select = mainDoc.getElementsByTagName("select")[1];
        var options = select.getElementsByTagName("option");

        var citiesArray = [];

        for ( var i = 0; i < options.length; i++) {

            cityObj = new Object();
            cityObj.name = options[i].text;
            cityObj.value = options[i].value;

            citiesArray.push(cityObj);
        }

        for ( var city = 0; city < citiesArray.length; city++) {
            document.getElementById("depart").innerHTML += "<option value='"+citiesArray[city].value+"'>"
                    + citiesArray[city].name + "</option>";
            document.getElementById("arrive").innerHTML += "<option value='"+citiesArray[city].value+"'>"
                    + citiesArray[city].name + "</option>";
        }

        applyChangeEvent();

    }

    function parse(html, id) {

        var pricesArray = [];

        //alert(id);

        var resultDoc = (new DOMParser()).parseFromString(html,
                "application/xhtml+xml");

        var divs = resultDoc.getElementsByTagName("table");
        for ( var div = 0; div < divs.length; div++) {
            if (divs[div].className == "fareCalendarTable") {
                //alert("found!");

                // TODO: find out how many to open!!
                document.getElementById(id).style.display = "block";
                document.getElementById("nav_").style.display = "block";

                var table = resultDoc.getElementsByTagName("table")[div];
                var divs = table.getElementsByTagName("div");
                //var tbodyTrs = tbody.getElementsByTagName("tr");

                //alert(document.getElementById("month-one").innerHTML);
                for ( var price = 0; price < divs.length; price++) {
                    if (divs[price].title != "") {

                        /*                      document.getElementById("month-one-results").innerHTML += divs[price].id
                         .replace("OutboundFareCal", "")
                         + " : " + divs[price].title + "<br>"; */

                        priceObj = new Object();
                        priceObj.date = divs[price].id.replace(
                                "OutboundFareCal", "");
                        priceObj.price = divs[price].title.replace(" NOK", "");
                        priceObj.price.replace(/\s/g, '');

                        pricesArray.push(priceObj);
                    }
                }

                /*              pricesArray.sort(function sortNumber(a, b) {
                 return parseInt(b) - parseInt(a);
                 }); */

                for ( var priceUnit = 0; priceUnit < pricesArray.length; priceUnit++) {
                    document.getElementById("month-results-" + id).innerHTML += "<table><tr><td>"
                            + pricesArray[priceUnit].date
                            + "</td><td>"
                            + pricesArray[priceUnit].price
                            + "</td></tr></table>";
                }

            }

            document.getElementById("depart").disabled = "disabled";
            document.getElementById("arrive").disabled = "disabled";
        }

        //  document.getElementById("results").innerHTML = bodybox.item(0).innerHTML;
        //holy grail!
        var month = document.getElementById("month-" + id);
        var spans = month.getElementsByTagName("span");

        for ( var span = 0; span < spans.length; span++) {
            if (spans[span].className == "ui-btn-text") {
                spans[span].innerHTML += "<p>" + getCheapest(pricesArray)
                        + "</p>";
            }
        }
    }

    function getCheapest(pricesArray) {
        pricesArray.sort(sort);

        return pricesArray[1].price;
    }

    function sort(a, b) {
        if (a.price < b.price)
            return -1;
        if (a.price > b.price)
            return 1;
        return 0;
    }

    function restart() {
        window.location.reload();
        return false;
        document.getElementById("depart").removeAttribute("disabled");
        document.getElementById("arrive").removeAttribute("disabled");
    }
</script>
<style>
body {
    display: block;
    padding: 20px;
    color: #3D3C2F;
    font-family: Arial, Sans-Serif, Helvetica;
    font-size: 12px;
    font-weight: normal;
}

div#content {
    margin-left: auto;
    margin-right: auto;
    background: #fff;
    height: 100%;
    -webkit-border-bottom-left-radius: 8px;
    -webkit-border-bottom-right-radius: 8px;
    display: block;
    color: #3D3C2F;
    font-family: Arial, Sans-Serif, Helvetica;
    font-size: 12px;
    font-weight: normal;
    background-image:
        url(http://www.norwegian.no/Global/backgrounds/background_no.gif);
    background-repeat: repeat-x;
    background-repeat-x: repeat;
    background-repeat-y: no-repeat;
    background-position-x: 0%;
    background-position-y: 0%;
    width: 100%;
    padding-top: 20px;
    padding-bottom: 30px;
}

div#navigation {
    margin-left: auto;
    margin-right: auto;
    padding: 20px;
    position: block;
    width: 80%;
    background: #CCCC00;
    -webkit-border-radius: 8px;
}

select {
    position: block;
    width: 100%;
    text-color: #000;
    overflow: hidden;
}
</style>
</head>
<body>
    <div id="nav_" data-role="header" data-position="inline" data-theme="e"
        style="display: none;">
        <a href="#" data-icon="back" data-theme="c"
            onClick="window.location.reload();return false;">Start</a>
        <h1>Ticket Prices</h1>
    </div>

    <div id="content">
        <div id="navigation">
            Fra/From: <select id="depart">
            </select> Til/To: <select id="arrive">
            </select>
        </div>

        <div data-role="collapsible" id="1"
            style="display: none; background: #fff; width: 97%; margin-left: auto; margin-right: auto;">
            <h3 id="month-1">January</h3>
            <p id="month-results-1"></p>
        </div>
        <div data-role="collapsible" id="2"
            style="display: none; background: #fff; width: 97%; margin-left: auto; margin-right: auto;">
            <h3 id="month-2">February</h3>
            <p id="month-results-2"></p>
        </div>
        <div data-role="collapsible" id="3"
            style="display: none; background: #fff; width: 97%; margin-left: auto; margin-right: auto;">
            <h3 id="month-3">March</h3>
            <p id="month-results-3"></p>
        </div>
        <div data-role="collapsible" id="4"
            style="display: none; background: #fff; width: 97%; margin-left: auto; margin-right: auto;">
            <h3 id="month-4">April</h3>
            <p id="month-results-4"></p>
        </div>
        <div data-role="collapsible" id="5"
            style="display: none; background: #fff; width: 97%; margin-left: auto; margin-right: auto;">
            <h3 id="month-5">May</h3>
            <p id="month-results-5"></p>
        </div>
        <div data-role="collapsible" id="6"
            style="display: none; background: #fff; width: 97%; margin-left: auto; margin-right: auto;">
            <h3 id="month-6">June</h3>
            <p id="month-results-6"></p>
        </div>
        <div data-role="collapsible" id="7"
            style="display: none; background: #fff; width: 97%; margin-left: auto; margin-right: auto;">
            <h3 id="month-7">July</h3>
            <p id="month-results-7"></p>
        </div>
        <div data-role="collapsible" id="8"
            style="display: none; background: #fff; width: 97%; margin-left: auto; margin-right: auto;">
            <h3 id="month-8">August</h3>
            <p id="month-results-8"></p>
        </div>
        <div data-role="collapsible" id="9"
            style="display: none; background: #fff; width: 97%; margin-left: auto; margin-right: auto;">
            <h3 id="month-9">September</h3>
            <p id="month-results-9"></p>
        </div>
        <div data-role="collapsible" id="10"
            style="display: none; background: #fff; width: 97%; margin-left: auto; margin-right: auto;">
            <h3 id="month-10">October</h3>
            <p id="month-results-10"></p>
        </div>
        <div data-role="collapsible" id="11"
            style="display: none; background: #fff; width: 97%; margin-left: auto; margin-right: auto;">
            <h3 id="month-11">November</h3>
            <p id="month-results-11"></p>
        </div>
        <div data-role="collapsible" id="12"
            style="display: none; background: #fff; width: 97%; margin-left: auto; margin-right: auto;">
            <h3 id="month-12">December</h3>
            <p id="month-results-12"></p>
        </div>
    </div>
    <!-- <div id="results"></div> -->
</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T01:56:37+00:00Added an answer on May 28, 2026 at 1:56 am

    If your directory structure is assets/www/js/jquery.js use :

    <script type="text/javascript" src="js/jquery.js"></script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I followed this link to install Phonegap eclipse plugin for android http://wiki.phonegap.com/w/page/34483744/PhoneGap%20Eclipse%20PlugIn%20for%20Android but its
I've created a very basic project on Android using Eclipse with PhoneGap following the
My issue is regarding PhoneGap and Android development using the Eclipse Applaud plugin. I
I am developing application using phonegap in eclipse for android .I have created folder
Question: How does one properly initialize a phonegap project for BlackBerry in Eclipse? Details:
I've written my first Android app (Sencha Touch + Phonegap using Eclipse on PC).
I have PhoneGap app in Android using jQuery. Sometimes I need to upload some
I am developing Palm Pre apps using the Eclipse IDE. How to setup Phonegap
I tried to follow this instruction: http://wiki.phonegap.com/w/page/16494774/Getting-started-with-Android-PhoneGap-in-Eclipse I can run the example but when
I am developing a mobile application in android using eclipse and phonegap. and my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.