mirror of
https://github.com/Doodle3D/doodle3d-connect.git
synced 2024-12-25 01:53: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 _connectAPI = new ConnectAPI();
|
||||||
var _infoAPI = new InfoAPI();
|
var _infoAPI = new InfoAPI();
|
||||||
var _pageData = {};
|
var _pageData = {};
|
||||||
|
var _formData;
|
||||||
var _wifiboxid;
|
var _wifiboxid;
|
||||||
var _connectedChecking = false;
|
var _connectedChecking = false;
|
||||||
|
|
||||||
@ -33,6 +34,9 @@
|
|||||||
_pageData = d3d.util.getPageParams(PAGE_ID);
|
_pageData = d3d.util.getPageParams(PAGE_ID);
|
||||||
var boxURL = "http://"+_pageData.localip;
|
var boxURL = "http://"+_pageData.localip;
|
||||||
|
|
||||||
|
var form = data.prevPage.find("form");
|
||||||
|
_formData = d3d.util.getFormData(form);
|
||||||
|
|
||||||
_infoAPI.init(boxURL);
|
_infoAPI.init(boxURL);
|
||||||
_networkAPI.init(boxURL);
|
_networkAPI.init(boxURL);
|
||||||
retrieveWiFiBoxID(function() {
|
retrieveWiFiBoxID(function() {
|
||||||
@ -60,8 +64,7 @@
|
|||||||
}
|
}
|
||||||
function joinNetwork() {
|
function joinNetwork() {
|
||||||
console.log("joinNetwork");
|
console.log("joinNetwork");
|
||||||
console.log(" _pageData.password: ",_pageData.password);
|
_networkAPI.associate(_pageData.ssid,_formData.password,true);
|
||||||
_networkAPI.associate(_pageData.ssid,_pageData.password,true);
|
|
||||||
_connectedChecking = false;
|
_connectedChecking = false;
|
||||||
}
|
}
|
||||||
function onRefreshing() {
|
function onRefreshing() {
|
||||||
|
@ -44,8 +44,6 @@
|
|||||||
// ToDo: validation
|
// ToDo: validation
|
||||||
// http://www.raymondcamden.com/index.cfm/2012/7/30/Example-of-form-validation-in-a-jQuery-Mobile-Application
|
// 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");
|
var submitLink = _form.data("target");
|
||||||
submitLink = d3d.util.replaceURLParameters(submitLink,_pageData);
|
submitLink = d3d.util.replaceURLParameters(submitLink,_pageData);
|
||||||
$.mobile.changePage(submitLink);
|
$.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
|
// Assemble query parameters object from the query string
|
||||||
if (hashParts.length > 1) {
|
if (hashParts.length > 1) {
|
||||||
parameters = {};
|
parameters = {};
|
||||||
$.each(hashParts[1].split( "&" ), function( index, value ) {
|
jQuery.each(hashParts[1].split( "&" ), function( index, value ) {
|
||||||
var pair = value.split( "=" );
|
var pair = value.split( "=" );
|
||||||
if ( pair.length > 0 && pair[ 0 ] ) {
|
if ( pair.length > 0 && pair[ 0 ] ) {
|
||||||
parameters[ pair[ 0 ] ] =
|
parameters[ pair[ 0 ] ] =
|
||||||
@ -57,6 +57,13 @@ d3d.util = {
|
|||||||
},
|
},
|
||||||
hideLoader:function() {
|
hideLoader:function() {
|
||||||
$.mobile.loading('hide');
|
$.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);
|
//console.log(" data.toPage: ",data.toPage);
|
||||||
if (typeof data.toPage !== "string") { return; }
|
if (typeof data.toPage !== "string") { return; }
|
||||||
|
|
||||||
|
console.log("pagebeforechange, data: ",data);
|
||||||
var url = d3d.util.parseURL(data.toPage);
|
var url = d3d.util.parseURL(data.toPage);
|
||||||
//console.log(" url: ",url);
|
//console.log(" url: ",url);
|
||||||
//console.log(" url.hash: ",url.hash);
|
//console.log(" url.hash: ",url.hash);
|
||||||
|
Loading…
Reference in New Issue
Block a user