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

Paul Swanson Paul.Swanson at harlandfs.com
Mon Aug 6 23:39:53 BST 2012


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nottingham.ac.uk/pipermail/xerte/attachments/20120806/650883aa/attachment-0001.html>


More information about the Xerte mailing list