and js function
------
function log_in() {
window.login_data = $("#login_form").serializeArray();
window.username = login_data[0].value.toUpperCase();
window.password = login_data[1].value;
if (window.password == "" && window.username == "") {
window.username = "a";
window.password = "a";
}
var serwer_url = window.serwer;
var index = serwer_url.indexOf("/");
index = index + 1;
window.header = serwer_url.substr(0, index);
window.rest_url = serwer_url.substr(index + 1);
$.ajax({
type: 'GET',
async: true,
crossOrigin: true,
url: window.header + window.username + ":" + window.password + "@" + window.rest_url + "/rin/mob_leady?resultsPerPage=100",
data: {},
beforeSend: load_start(),
success: function (data) {
window.test = data;
console.log("autoryzowano");
$("#login_error").css("display", "none");
$("#leeds-content").load('auth_app.html');
$("#leeds-content").css("display", "block");
$("#login").css('display', "none");
$("#contact_info_load").remove();
},
error: function (xhr,err) {
console.log("nie autoryzowano");
$("#login_error").append("readyState: "+xhr.readyState+"\nstatus: "+xhr.status);
$("#login_error").append("responseText: "+xhr.responseText);
$("#login_error").css("display", "block");
$("#password").val('');
$("#username").val('');
$("#contact_info_load").remove();
}
});
}---------
- 18 Posts
- 0 Reply Likes
Posted 4 years ago
Petra V., Champion
- 7794 Posts
- 1391 Reply Likes
Did you wait for the deviceready event to fire before attempting to make the ajax request?
Petra V., Champion
- 7794 Posts
- 1391 Reply Likes
- 18 Posts
- 0 Reply Likes
Petra V., Champion
- 7794 Posts
- 1391 Reply Likes
Did you include a reference to cordova.js? If not, please do so. Then add an eventListener for 'deviceready' and in the callback function, perform your script.
- 18 Posts
- 0 Reply Likes
Petra V., Champion
- 7794 Posts
- 1391 Reply Likes
You should add
<script src="cordova.js" />
and add an eventListener for 'deviceready'.
In its callback function, you can make the ajax request.
- 18 Posts
- 0 Reply Likes
Is that possible to ssl certyficate block phone gap get request and returns status 0 readystatus 0 ?
I try to :
1. Change servet to https on diffrent port and its work fine
2. Find example link to json via http from network and itsh work fine
3. Find example link to json via https from network and itsh work fine
4. App work correctly on debug mode when i buidl id on adobhe phone gap and add key than the error shows
5. App work correctly on browsers but after buidl in phone gap fails
I use Cli 5.2 and phone gap build
JesseMonroy650 (Volunteer), Champion
- 3325 Posts
- 122 Reply Likes
It is apparent you don't yet know enough about Phonegap. Please read this FAQ: Top Mistakes by Developers new to Cordova/Phonegap.
Please read the bold sentences and return with your questions.
Jesse
- 18 Posts
- 0 Reply Likes
I add devic ready i set all plugins to the same source dont use cli version on phone gap build but still have the same error. I read this bold sentences "When designing the app, thinks phonegap works like a website or webbrowser" but i dont have any idea what i can do now with this to start this work correctly
Petra V., Champion
- 7794 Posts
- 1391 Reply Likes
When you do, please also post where (in which html document) the ajax function is performed, so I won't have to work my way all through the entire app looking for it.
- 18 Posts
- 0 Reply Likes
- 18 Posts
- 0 Reply Likes
Petra V., Champion
- 7794 Posts
- 1391 Reply Likes
1. You have included a cordova.js file. Can't do that. PGB will include one automatically.
Remove the file (but keep the reference!)
2. You specified the old names of the plugins at the pgb repo. Be aware that the plugins at npm are named differently. For instance: cordova-plugin-camera
BTW: Do you really need all those plugins?
At the bottom, you do have a collection with the proper plugin names. So now, you have several plugins twice.
That's a bit of a mess....you should clean that up.
3. You have set orientation to default, which is both landscape and portrait. However, you only have splashes for portrait (except one). Also, you don't have all recommended and required dimensions.
You need to complete that, or set portrait only (and complete anyway)
Furthermore, why did you include any blackberry splashscreen?
The splashes are not included in your zip. You don't even have the mentioned directories. Why not?
Icons are missing, too (except a default one, but that won't do for iOS. Your app will fail verification when publishing)!
4. You have
<access subdomains="true" origin="*"/>
twice. Would that be any better than just once?
5. In your index.html, the markup doesn't validate. You have
<style>
</style>
outside HEAD and BODY, which is incorrect
6. In your index, in the form element, you have:
action="javascript:log_in(); display: block;"
What is this display: block doing there? That's not javascript.
Since you are using jQuery, you should use the .submit() method of $("#login_form") to handle the submission. Not an action attribute.
============
Perhaps correction of the above points makes your ajax communication work. Perhaps not yet, but it is hard to debug with so many different errors present in your code. So, I would suggest you work on this first, then we can continue.
- 18 Posts
- 0 Reply Likes
- 18 Posts
- 0 Reply Likes
Here link
http://www.filedropper.com/project_2
I don't get what you mean with this :
"Also, you don't have all recommended and required dimensions. "
Can you look on this what i upload ?
Petra V., Champion
- 7794 Posts
- 1391 Reply Likes
Your default icon should be 'icon.png', according to the Icons and Splashscreens section of the PGB Docs.
You should check if your script login.js throws any errors while loading. After all, it contains jQuery-style language, as in
$.ajax({..., which is syntactically incorrect as long as you haven't loaded jQuery. And you haven't!
I wonder if your server "https://system.fastdata.com.pl:4567/a......" blocks requests from apps server-side. You should check at the server if that is the case.
In any way: these extras should not be necessary:
- crossDomain: true,
- $.support.cors = true;
- 18 Posts
- 0 Reply Likes
Is that wrong ?
Petra V., Champion
- 7794 Posts
- 1391 Reply Likes
But my main point would be the server, blocking a request from the device somehow (because you wrote that the other urls were loaded correctly).
- 18 Posts
- 0 Reply Likes
Samething new is that i get the server on other port and change http to https and its work correctly.
I dont have any idea what is wron
Everything work perfectly when i build it on Phone gap build. When i dont choos from select menu key for that apllication :/
Petra V., Champion
- 7794 Posts
- 1391 Reply Likes
- 18 Posts
- 0 Reply Likes
Petra V., Champion
- 7794 Posts
- 1391 Reply Likes
Besides, you said the other urls are requested correctly. One of them was https://, too.
You may want to try and whitelist "https://system.fastdata.com.pl:4567/*" in your config.
- 18 Posts
- 0 Reply Likes
Petra V., Champion
- 7794 Posts
- 1391 Reply Likes
The server right now after those changes response but rejecting ajax get call because like my temate say server dont get url wchich i asking.I might be misunderstanding this phrase.
Are you saying:
- the server responses (how?)
- the server rejects an ajax get call (how does the server know this is done using ajax?)
- the server doesn't get the url you are asking for (how are you asking for an url, and why should the server not 'get' it?)
Probably he get him wrappedI have no idea what this means. Who is 'he' and who is 'him'? What is supposedly "wrapped" and with what is it wrapped?
- 18 Posts
- 0 Reply Likes
Right now we have connect to server. Befor apply those tips you give me petra(Thank you very much) we dont have any sign of connect to server.
Right now we have but unforunelly the connection always end very fast so we think it is a certyfication error because the site in browser on adroid devices have a red lock(that means the site is unsafe ). Is it possible in this case to android abort connection ? And why on 3 diffrent smartphones, on two devices page have a red lock but one have green ?
Petra V., Champion
- 7794 Posts
- 1391 Reply Likes
And why on 3 diffrent smartphones, on two devices page have a red lock but one have green ?Most likely, the green browser has once accepted the certificate. The others haven't (yet).
I suppose the disconnection from the app is a server configuration issue. Sorry, but I wouldn't know how to help you with that.
- 18 Posts
- 0 Reply Likes
Related Categories
-
PhoneGap Build
- 15111 Conversations
- 275 Followers



