Note that there are some explanatory texts on larger screens.

plurals
  1. POPhoneGap (Cordova.js) and JQuery.Ajax not working together
    primarykey
    data
    text
    <p>I have built a html page using Phonegap+Jquery targeting Andriod 4.12.</p> <p>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.</p> <p>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.</p> <p>I am attaching my code for reference.</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Capture Photo&lt;/title&gt; &lt;script type="text/javascript" charset="utf-8" src="cordova-2.1.0.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" charset="utf-8" src="jquery.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; 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; } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;input type=text id=txtname value=John /&gt; &lt;input type=text id=txtpwd value=Doe /&gt; &lt;input type="button" id="btnSearch" onclick="InsertDetails();" style="cursor: pointer; margin-top: 8px; vertical-align: top" value="Insert Details" /&gt; &lt;button id=btn1&gt;Capture Photo&lt;/button&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Please help me out in this.</p>
    singulars
    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.
 

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