Jquery Ajax get method not working with PhoneGap - ajax

Hello am creating an app that uses jquery ajax get method to receive data from a text file to use for my app, its working great in the browser but when export my app to android using PhoneGap the text is not displaying. But the rest of the app has loaded now i assume this is because something went wrong. Am new to PhoneGap can anyone assist me this is my code.
// Ajax code that recieve data from text file
$.get('/info/animal.txt',function(data){
var lines = data.split("~");

Related

Integrating Surveyjs with Nativescript + Angular

I am trying to merge surveyjs along with my NativeScript application. I have referred URL for merging the same with Angular application
From the Angular demo code given on website, we have to add event handler for Complete button where we can get the response from surveyjs. Is it possible to integrate similarly for Nativescript Mobile application? Here is the approach which i feel can be taken.
Display
Create a HTML as provided by SurveyJS with required CSS and JS
referenced and add them as a file in project.
Modify HTML once i get the survey question json back from server.
Show the HTML as part of WebView. This will take care of displaying
the survey on my Application.
Here are my challenges during Submission
As per the process given on SurveyJS, i need to add handler for
oncomplete which will get the result json for me. How can i add
handlers for Complete button click in my code? Also please note that
there is a possibility that there may be multiple surveys on a single
page.
Apart from Survey, there are other fields also on the page and user
will submit them all in one go by clicking submit button of the page.
Hence i am planning to hide Complete button provided by SurveyJS
page. This needs to be triggered via code. Can this be done?
If someone can give directions on whether this scenario can be handled in nativescript application with Angular,it would help immensely.
yes it can be done using nativescript-webview-interface plugin.
add jS code inside WebView to handle oncomplete event from surveyJS. and on that function call emit some event to native app. after that add nativescript code to listen for that event and get the JSON back.
inside webView JS function
var oWebViewInterface = window.nsWebViewInterface;
// emit event to native app
oWebViewInterface.emit('anyEvent', jsonData);
inside native App
oWebViewInterface.on('anyEvent', function(jsonData){
// perform action on event
});
for more details on this you can check plugin readme file https://github.com/shripalsoni04/nativescript-webview-interface

Windows Store App WebView Ajax request from local html file

I have a question similar to this WebView Windows Store App C# Ajax Not Working
I am loading a local html file onto WebView using :
webView.NavigateToLocalStreamUri(pageUri, localUriResolver_);
I am trying to make a ajax call to remote server. I am getting an error with status=0.
I tried with both jquery and plain XmlHttpRequest, results are same. I am not able to get remote file content.
At the same time, I am able to load local file. As all local files are redirected to my "localUriResolver", i am able to resolve the url and provide the content to ajax call.
Coming to remote content, I know this is cross domain request issue.
Is there a way to get around it on Windows 8.1 WebView. Is there some flag to override the cross-domain origin policy.
Thanks
I believe I am running into the same issue right now. It would appear as though my ajax request is not completing.
I see that our API is hit on our server but the complete callback of my jQuery ajax request is never triggered.
Currently investigating why, please update this if you've found a work around or solution.

iOS Share Extension Dynamic Javascript

I am developing a share extension for iOS 8 and it seem like i can run javascript code on page to grab some information like image urls, etc.
But on the apple document it says that javascript code must be inside a .js file but my javascript code is coming from server and it is dynamic.
Is it possible to run javascript i downloaded from server or can I change js file contents everytime I need to use it?
Thanks
Edit
It seems like it is impossible to change the file.
And if your javascript making asynchronous call the loadItemForTypeIdentifier: options: completionHandler: call is not grabing the end value of async call.

KendoUI upload not working in IE9

I am using Kendoui upload control (Async mode) in my asp.net application.I am able to successfully upload file using Google chrome,Firefox and IE10 but in IE9 ,upload event fires and file uploads successfully but success event of kendo upload does not fire and it always goes to error event.
kendo upload make ajax call to asp.net apiController where I have written sub which does not return anything.
I get response with 204 code which shows no content.I tried to return json as response but still in that case success event of kendoui upload does not fire.
below are the urls of screenshots my response header and body.
http://screencast.com/t/0KQ0KF9mC
http://screencast.com/t/tCAC1JJ6No59
Please help me.
Regards
Imran
It's been a while, so you may have solved this already, but I had the same problem and the solution was simple:
Set the response header content-type to 'text/html'

how to return to ajax enviroment after upload a file using iframe

hi im working into a full ajax enviroment page, but i have the need to upload a file into my app, i used an iframe to "display" my form to upload (since i cant upload a file using pure ajax enviroment) but when i try to return to my ajax enviroment i cant get the view that i need, i keep locked "inside" the iframe, any ideas how to get out of the iframe and continue my app processing?
or an alternative to do this using jquery?
thanks a lot Mitzato
edit
im using rails 3
some html5
and ajax
You could update a div in the parent of the iframe with the response you get in the iframe using the top.document, like:
$("#myid", top.document);
You would need to include jquery.js in the iframe...
Well the final solution was to create a parent div and in another view create the iframe, then insert my form into my iframe, and finally I add and script in the botton that deletes the div where the iframe is contained that returns me to my ajax environment.

Resources