[Xerte] Re: Desktop Xerte 2.17 -- having trouble reading data from external script

Dave Burnett d_b_burnett at hotmail.com
Tue Aug 7 01:00:43 BST 2012


What if it's on an actual web server?


From: Paul.Swanson at harlandfs.com
To: xerte at lists.nottingham.ac.uk
Date: Mon, 6 Aug 2012 22:39:53 +0000
Subject: [Xerte] Desktop Xerte 2.17 -- having trouble reading data from external script











I’m have a devil of a time getting a Xerte app to read the response from a PHP script when run through a browser. It works fine in Preview mode, and I know the script is getting the login information and returning
 a string because in preview mode I receive and can display the correct response with info from my database. I also have the PHP database script email me the same string. This works beautifully in Preview mode, but when I copy my
rlo and other published files to 
localhost and run it from there, Xerte prints ‘undefined’ for the
rawData property returned from a 
sendAndLoadVars call. The database script still emails me the correct response.
 
Here’s what I’m sending to my PHP authentication script (domain is defined in a login script, and the parent Page icon has an id of
loginCheck):
// real
url
URLString = domain + '/wbt/app/admin/authenticate.php';
 
// pass values to external script
loginVars = new
LoadVars ();
loginVars.action = 'authenticate';
loginVars.login = username;
loginVars.sku =
sku;
 
// send to login script
loginCheck.sendAndLoadVars(URLString,
loginVars);
 
Following the above, I have an Interaction with an Event icon (eventName =
onSendAndLoadVars, icon = loginCheck). Attached to the event is a script icon with:
// initialize
btnPath -- assume not authenticated
btnPath = 1; // 1 is the fail path
message = ''; // initialize message
responseMessage = ''; // initialize response message
 
rawStuff =
loginCheck.rawData;
loginInstructions.setText(loginCheck.rawData);
 
//rawStuff = replace(rawStuff, '<sup>®</sup>', '');
rawInfoArray =
rawStuff.split('&'); // save string pairs into an array
 
for (i = 0;
i < rawInfoArray.length; 
i++) { // break pairs into smaller arrays and parse
 

  tempArray =
rawInfoArray[i].split('='); // split on = sign
   

  switch (tempArray[0]) {
   
case 'reg_id':
     
sid = tempArray[1];
     
btnPath = 0;
     
break;
   
case 'message':
     
responseMessage = tempArray[1];
     
break;
 
}
 
}
 
debug('sid: ' +
sid + '\nresponseMessage: ' +
responseMessage);
debug(loginCheck.rawData);
 
// display appropriate response
if (btnPath == 1) {

  message = '<p>Could not retrieve account from the database.</p><br /><p>' +
responseMessage + '</p>';
}
 
I get all the expected debug info in Preview and login is successful. Debug response is:
sid: 71
responseMessage: User Found in Database<br/>
 
reg_id=71&message=User Found in Database<br/>
 
0
 
Any ideas would be appreciated.
 
Paul Swanson
Internal Business Systems Analyst
Internal Business Intelligence
Harland Financial Solutions
(800) 274-7280 Ext. 2462
Paul.Swanson at harlandfs.com
 




This message and any attachment are intended solely for the addressee and may 
contain confidential information. If you have received this message in error, 
please send it back to me, and immediately delete it.   Please do not use, 
copy or disclose the information contained in this message or in any attachment.  
Any views or opinions expressed by the author of this email do not necessarily 
reflect the views of the University of Nottingham.


This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.




_______________________________________________
Xerte mailing list
Xerte at lists.nottingham.ac.uk
http://lists.nottingham.ac.uk/mailman/listinfo/xerte

This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it.   Please do not use, copy or disclose the information contained in this message or in any attachment.  Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.

This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation. 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nottingham.ac.uk/pipermail/xerte/attachments/20120806/9515a3a4/attachment-0001.html>


More information about the Xerte mailing list