mirror of
https://github.com/Doodle3D/doodle3d-connect.git
synced 2024-12-24 17:43:48 +01:00
Retrieve form data from form instead of url parameters
This commit is contained in:
parent
7329682626
commit
8693437cdb
@ -15,6 +15,7 @@
|
||||
var _connectAPI = new ConnectAPI();
|
||||
var _infoAPI = new InfoAPI();
|
||||
var _pageData = {};
|
||||
var _formData;
|
||||
var _wifiboxid;
|
||||
var _connectedChecking = false;
|
||||
|
||||
@ -33,6 +34,9 @@
|
||||
_pageData = d3d.util.getPageParams(PAGE_ID);
|
||||
var boxURL = "http://"+_pageData.localip;
|
||||
|
||||
var form = data.prevPage.find("form");
|
||||
_formData = d3d.util.getFormData(form);
|
||||
|
||||
_infoAPI.init(boxURL);
|
||||
_networkAPI.init(boxURL);
|
||||
retrieveWiFiBoxID(function() {
|
||||
@ -60,8 +64,7 @@
|
||||
}
|
||||
function joinNetwork() {
|
||||
console.log("joinNetwork");
|
||||
console.log(" _pageData.password: ",_pageData.password);
|
||||
_networkAPI.associate(_pageData.ssid,_pageData.password,true);
|
||||
_networkAPI.associate(_pageData.ssid,_formData.password,true);
|
||||
_connectedChecking = false;
|
||||
}
|
||||
function onRefreshing() {
|
||||
|
@ -44,8 +44,6 @@
|
||||
// ToDo: validation
|
||||
// http://www.raymondcamden.com/index.cfm/2012/7/30/Example-of-form-validation-in-a-jQuery-Mobile-Application
|
||||
|
||||
var linkParams = _pageData;
|
||||
linkParams.password = _passwordField.val();
|
||||
var submitLink = _form.data("target");
|
||||
submitLink = d3d.util.replaceURLParameters(submitLink,_pageData);
|
||||
$.mobile.changePage(submitLink);
|
||||
|
10
js/main.js
10
js/main.js
@ -16,7 +16,7 @@ d3d.util = {
|
||||
// Assemble query parameters object from the query string
|
||||
if (hashParts.length > 1) {
|
||||
parameters = {};
|
||||
$.each(hashParts[1].split( "&" ), function( index, value ) {
|
||||
jQuery.each(hashParts[1].split( "&" ), function( index, value ) {
|
||||
var pair = value.split( "=" );
|
||||
if ( pair.length > 0 && pair[ 0 ] ) {
|
||||
parameters[ pair[ 0 ] ] =
|
||||
@ -57,6 +57,13 @@ d3d.util = {
|
||||
},
|
||||
hideLoader:function() {
|
||||
$.mobile.loading('hide');
|
||||
},
|
||||
getFormData:function(form) {
|
||||
var formData = {};
|
||||
jQuery.each(form.serializeArray(), function(index,field) {
|
||||
formData[field['name']] = field['value'];
|
||||
});
|
||||
return formData;
|
||||
}
|
||||
};
|
||||
|
||||
@ -73,6 +80,7 @@ d3d.util = {
|
||||
//console.log(" data.toPage: ",data.toPage);
|
||||
if (typeof data.toPage !== "string") { return; }
|
||||
|
||||
console.log("pagebeforechange, data: ",data);
|
||||
var url = d3d.util.parseURL(data.toPage);
|
||||
//console.log(" url: ",url);
|
||||
//console.log(" url.hash: ",url.hash);
|
||||
|
Loading…
Reference in New Issue
Block a user