ibm mobilefirst - IBM Worklight - Could not invoke the SQL adapter procedure for the insert query from the client side . What's wrong with my coding? -
i'm getting blank screen while running code in webpage. adapter procedure alone getting invoked correctly couldn't invoke client side.i'm using db2 database. please help.
here javascript code..
function loaddetails(x,y,z,a,b,c,d,e,f,g,h,i){
var x= document.getelementbyid("firstname").value; var y= document.getelementbyid("lastname").value; var z= document.getelementbyid("doorno").value; var a= document.getelementbyid("streetname").value; var b= document.getelementbyid("area").value; var c= document.getelementbyid("zipcode").value; var d= document.getelementbyid("landmark").value; var e= document.getelementbyid("secques").value; var f= document.getelementbyid("secans").value; var g= document.getelementbyid("emailaddress").value; var h= document.getelementbyid("username").value; var i= document.getelementbyid("password").value; var invocationdata = { adapter : 'dbadapter', procedure : 'adddbadapter', parameters : [x,y,z,a,b,c,d,e,f,g,h,i] }; wl.client.invokeprocedure(invocationdata,{ onsuccess : loaddetailssuccess, onfailure : loaddetailsfailure }); }
function loaddetailssuccess(){
alert("registration successfull. please login continue..."); window.location.href = 'login.html'; }
function loaddetailsfailure(){
wl.logger.error("load data failure"); }
dbadapter-impl.js
var addstatement = wl.server.createsqlstatement("insert customer(firstname,lastname,doorno,area,streetname,zipcode,landmark,secques,secans,emailaddress,username,password) values (?,?,?,?,?,?,?,?,?,?,?,?)");
function adddbadapter(x,y,z,a,b,c,d,e,f,g,h,i) {
return wl.server.invokesqlstatement({ preparedstatement : addstatement, parameters : [x,y,z,a,b,c,d,e,f,g,h,i] }); }
as eabe rightly mention in comments, , we've missed it(!), worklight single page application , indeed window.location.href = 'login.html'; seems culprit here.
see related question on subject matter contain solutions:
basically, can use either jquery's .load or jquery mobile's .changepage (or equivalent of other libraries same) in order load contents of page, or "switch" another. doing do, lost worklight "context" , nothing work or display.
also review training material:
Comments
Post a Comment