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

  • SEARCH
  • Home
  • 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 8913131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:23:01+00:00 2026-06-15T04:23:01+00:00

I have built a html page using Phonegap+Jquery targeting Andriod 4.12. My business requirement

  • 0

I have built a html page using Phonegap+Jquery targeting Andriod 4.12.

My business requirement is to take a picture using the camera API of cordova.js and then post this captured picture to a ASMX web service.

Problem : When I add a reference to Cordova.js and run the application I get an error in the LogCat “Uncaught ReferenceError: $ is not defined” but if i remove the reference to cordova.js everything works fine and i am able to post data to web service.

I am attaching my code for reference.

<!DOCTYPE html>
<html>  
<head>    
<title>Capture Photo</title>   
<script type="text/javascript" charset="utf-8" src="cordova-2.1.0.js"></script>
<script type="text/javascript" charset="utf-8" src="jquery.js"></script> 

<script type="text/javascript">

 var varType;
 var varUrl;
 var varData;
 var varContentType;
 var varDataType;
 var varProcessData;

  function InsertDetails() {
        alert('Inserting Details');
        varType = "POST";
        varUrl = "http://mobile.comp.com/service/userservice.asmx/InsertDetails";
        varContentType = "application/json; charset=utf-8";
        varDataType = "json";
        varProcessData = true;

        var uname = document.getElementById('txtname');
        var pwd = document.getElementById('txtpwd');
        CallService(uname.value, pwd.value);

        return true;
    }

    //Generic function to call AXMX/WCF  Service        
    function CallService(u, p) {
        $.ajax({ type: varType, url: varUrl, data: '{"username":"' + u + '","password":"' + p + '"}', contentType: varContentType, dataType: varDataType, processdata: varProcessData, success: function (msg) { ServiceSucceeded(msg); }, error: ServiceFailed });
    }

    function ServiceSucceeded(result) {

        var myObject = eval('(' + result.d + ')');
        alert(myObject);
    }
    function ServiceFailed(result) {
        alert('Service call failed: ' + result.status + '' + result.statusText);
        varType = null; varUrl = null; varData = null; varContentType = null; varDataType = null; varProcessData = null;
    } 
</script>
</head>
<body>
<input type=text id=txtname value=John />
<input type=text id=txtpwd value=Doe /> 
<input type="button" id="btnSearch" onclick="InsertDetails();" style="cursor: pointer;
    margin-top: 8px; vertical-align: top" value="Insert Details" />

     <button id=btn1>Capture Photo</button> 

</body>
</html>

Please help me out in this.

  • 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-06-15T04:23:02+00:00Added an answer on June 15, 2026 at 4:23 am

    Thanks Nick for your help. The 3rd link helped

    Finally my code worked

    I added the following line of code which did the magic for me.

    jQuery.noConflict();
    

    JQuery was recognised after that. Make sure to follow the proper sequence for javascripts else the code will not work.

    The sequence in which I referred the js files:

    1. Reference to JQuery.js (locally added to project)
    2. jQuery.noConflict();
    3. Javascript Code for service calls
    4. Reference to Cordova.js
    5. Cordova Camera interaction code
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page built using HTML/CSS that is meant to be used for
I have a client who has built her entire site using html extensions. As
I am quite new to django, and I have built a small page using
I have been using phonegap.js with jqm to built a mobile android app. I
I am trying to learn javascript/jquery, using firebug to debug and have built a
I have an app built using jQuery (and using various jQuery-UI tools). For some
I have built some code that sorts an index page, using links in my
I have a dynamic list loaded into a HTML 5 web app built using
I have an html page that's built dynamically. Some of the images come from
I have a box built via html borders. I want to connect the bottom

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.