Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Developer
Posts: 63
Registered: ‎10-07-2009
My Device: Not Specified
Accepted Solution

PlayBook can not lauching ajax request

Hello, we was testing a playbook trying to load a simple app webwork:

 

 

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="initial-scale=0.0" />

<title>APP TEST</title>
<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/settings.js"></script>
</head>

<body>
<div id="content-mobile">
</div>
</body>

<script type="text/javascript">
alert(settings.domain);
new Ajax.Request(settings.domain + '?pin='+ blackberry.identity.PIN +'&imei='+ blackberry.identity.IMEI ,{
	method: 'get',
	onSuccess: function(transport) {
		$('content-mobile').update(transport.responseText);
	},
	onFailure: function(){ 
		alert(text.errconnect + "\n" + settings.domain);
		if(confirm(text.confirmconfig)) window.location='settings.html';
		else  blackberry.app.exit();
	}
});
</script>
</html>

 

 

Show the alert but the AJAX request does not response, and the playbook don't show anything.

 

 

<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:rim="http://www.blackberry.com/ns/widgets" version="1.3.37">
  <name>TABLET APP</name>
  <description>Testing an app</description>
  <author email="info@company.net" href="http://www.company.net">CompanyGroup</author>
  <feature id="blackberry.app" required="true" version="1.0.0.0"/>
  <feature id="blackberry.app.event" required="true" version="1.0.0.0"/>
  <feature id="blackberry.find" required="true" version="1.0.0.0"/>
  <feature id="blackberry.identity" required="true" version="1.0.0.0"/>
  <feature id="blackberry.identity.phone" required="true" version="1.0.0.0"/>
  <feature id="blackberry.invoke" required="true" version="1.0.0.0"/>
  <feature id="blackberry.invoke.AddressBookArguments" required="true" version="1.0.0.0"/>
  <feature id="blackberry.invoke.BrowserArguments" required="true" version="1.0.0.0"/>
  <feature id="blackberry.invoke.CalendarArguments" required="true" version="1.0.0.0"/>
  <feature id="blackberry.invoke.CameraArguments" required="true" version="1.0.0.0"/>
  <feature id="blackberry.invoke.JavaArguments" required="true" version="1.0.0.0"/>
  <feature id="blackberry.invoke.MapsArguments" required="true" version="1.0.0.0"/>
  <feature id="blackberry.invoke.MemoArguments" required="true" version="1.0.0.0"/>
  <feature id="blackberry.invoke.MessageArguments" required="true" version="1.0.0.0"/>
  <feature id="blackberry.invoke.PhoneArguments" required="true" version="1.0.0.0"/>
  <feature id="blackberry.invoke.SearchArguments" required="true" version="1.0.0.0"/>
  <feature id="blackberry.invoke.TaskArguments" required="true" version="1.0.0.0"/>
  <feature id="blackberry.io.dir" required="true" version="1.0.0.0"/>
  <feature id="blackberry.io.file" required="true" version="1.0.0.0"/>
  <feature id="blackberry.message" required="true" version="1.0.0.0"/>
  <feature id="blackberry.pim.Address" required="true" version="1.0.0.0"/>
  <feature id="blackberry.pim.Appointment" required="true" version="1.0.0.0"/>
  <feature id="blackberry.pim.Attendee" required="true" version="1.0.0.0"/>
  <feature id="blackberry.pim.category" required="true" version="1.0.0.0"/>
  <feature id="blackberry.pim.Contact" required="true" version="1.0.0.0"/>
  <feature id="blackberry.pim.Memo" required="true" version="1.0.0.0"/>
  <feature id="blackberry.pim.Recurrence" required="true" version="1.0.0.0"/>
  <feature id="blackberry.pim.Reminder" required="true" version="1.0.0.0"/>
  <feature id="blackberry.pim.Task" required="true" version="1.0.0.0"/>
  <feature id="blackberry.push" required="true" version="1.0.0.0"/>
  <feature id="blackberry.system" required="true" version="1.0.0.0"/>
  <feature id="blackberry.system.event" required="true" version="1.0.0.0"/>
  <feature id="blackberry.ui.menu" required="true" version="1.0.0.0"/>
  <feature id="blackberry.utils" required="true" version="1.0.0.0"/>
  <access subdomains="true" uri="http://domain.com" />
 
  <content src="index.html"/>
  <rim:loadingScreen backgroundColor="#000000" backgroundImage="images/loadinggrey.png" foregroundImage="images/loading.png" onRemotePageLoad="true" onLocalPageLoad="true" onFirstLaunch="true">
    <rim:transitionEffect type="slideOver" direction="left"/>
  </rim:loadingScreen>
  <rim:navigation mode="focus"/>
  <rim:cache disableAllCache="true"/>
</widget>

 Seems an access problem, but I changed the access: 

<access subdomains="true" uri="*" />

 

and doesn't run.

 

any suggestion?

 

Thanks

Highlighted
Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: PlayBook can not lauching ajax request

Ah... I believe the issue is that you are grabbing blackberry.identity.PIN

 

There are two problems with this..

 

1) This API is not avaialbe on the PlayBook environment so most likely it is failing when called

 

2) The WebWorks SDK on PlayBook has a known issue where the APIs are not available to use until the document has entirely loaded.  So an inline use of the API in a script tag will fail.

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter