- This topic has 4 replies, 3 voices, and was last updated 10 years, 6 months ago by Code_A.
-
AuthorPosts
-
idkpmillerMemberHi,
I am using mobione v2.6.2
The application should be provided with a URL and when it receives XML display this in a textarea. The app should support sites that have basic auth.I have put together some code that deals with a standard html page with basic auth and the success trigger fires for this use case; however if I point the app to a url that has xml content in the response It does not fire the success event. looking at the transactions on wireshark I can see that the 200 response is received and does have xml message content.
Are you able to help me?The login function I am using:
function Login() { var url = $('#m1-Poster-url').val(); var user = $('#m1-Poster-userid').val(); var pass = $('#m1-Poster-pass').val(); $.ajax({ type: "GET", url: url, dataType: "xml", timeout: 8000, username: user, password: pass, success: function (xml, textStatus, response) { alert( "Response: " + textStatus); } }); updateTextArea('Login Function Complete'); }
Thanks
Paul
Code_AMemberHere is a working example that is similar to what you are trying to do. You should be able to quickly modify it to work with your situation to see if you can get the communication going.
Attachments:
You must be logged in to view attached files.
support-michaelKeymasterI usually fire up the chrome dev tools to get deeper insight into such errors. Also I would include an error handler.
Here is a working example that uses the done() promise in place of the success callback. The success callback has been deprecated for a while now. The url will return the elevation of dallas, tx.
$.ajax({url: "http://www.earthtools.org/height/32.7758/-96.7967"}) .done( function(data, status) { alert("success: " + data); } ) .fail( function(jqXHR, status) { alert("fail: " + status); } )
idkpmillerMemberThanks you both for your response, the example from Code A was of particular help.
However using the example and the code attached to the SUBMIT button a small change to
add the ajax parameters for username/password response seems to break things; here is the slightly modified code//THIS WORKS FOR TEXT!!! webReq = jQuery.ajax({ url: $("#m1-XSI-urlEntry").val(), username: "myusername", password: "secret", type: "GET", dataType : "html", contentType : "text/plain; charset=utf-8" }); // END of JQuery Ajax
Is this a bug with mobione?
Thanks
Paul
Code_AMemberTry passing your data like this instead:
webReq = jQuery.ajax({ url: $("#m1-XSI-urlEntry").val(), username: "myusername", password: "secret", data : { username : "myusername", password : "secret" }, type: "GET", dataType : "xml", contentType : "text/plain; charset=utf-8", async : false }); // END of JQuery Ajax
-
AuthorPosts