jquery - Ajax call throwing "TypeError: object is not a function" Exception -
this code throwing typeerror idea salt remote external server , append password , generate hash. problem code throwing typeerror says
typeerror: object not function
the following part of index_user_scripts.js .
/*jshint browser:true */ /*global localstorage, console, $ */ (function(){ "use strict"; /* * hook event handlers */ function register_event_handlers(){ $(document).ready(function(){ try { if(!window.opendatabase) { console.log('local databases not supported browser.'); } else { var shortname = 'chtrshk'; var version = '1.0'; var displayname = 'chhatrasahayak'; var maxsize = 2*1024*1024; var db = window.opendatabase(shortname, version, displayname, maxsize); } } catch(e) { if (e == 2) { // version mismatch. console.log("invalid database version."); } else { console.log("unknown error "+ e +"."); } return; } if ( localstorage.getitem("islogged") === true ){ $("#cs_now")[0].click(); }else{ localstorage.cleardata; console.log("we haven\'t logged-in yet. let\'s login."); console.log(window.location.pathname); window.location = "index.html#login"; } }); /* button #login */ $(document).on("click", "#signin", function(evt) { if ($("[name=lg_pass]")[0].value === "" || $("[name=lg_roll]")[0].value === ""){return false;} console.log($("[name=lg_roll]")[0].value); console.log($("[name=lg_pass]")[0].value); var salt = ''; try{ $.ajax({ async: true, crossdomain: true, url:"http://borngeek.tk/cs/in.php", type:"post", datatype:"jsonp", timeout: 5000, success: function(response){ salt = response._s; console.log("success: fetched salt. " + salt); }, error: function(data){ console.error("error: failed fetch salt."); } }); }catch(e){console.error(e.name + ": " + e.message);} console.log("checkpoint."); var passstr = $("[name=lg_pass]")[0].value.concat(salt); passstr = hex_sha512(passstr); console.log(passstr); try{ $.ajax({ async: true, crossdomain: true, url:"http://borngeek.tk/cs/in.php", type:"post", data:{"roll":$("[name=lg_roll]")[0].value, "pass":passstr, "salt":$("[name=lg_salt]")[0].value }, success: function(response){console.log("login successful.");}, error: function(response){console.log("bad login attempt.");} }); }catch(e){console.error(e.name + ": " + e.message);} console.log("login attempt."); return false; }); } document.addeventlistener("app.ready", register_event_handlers, false); })();
just scanning through function calls in code, window.opendatabase(...)
seems candidate. seems web sql database api isn't broadly supported, reported in accepted answer this similar question.
Comments
Post a Comment