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
tensioncore
Posts: 326
Registered: ‎12-13-2010
My Device: Bold 9900/Z10 Special Edition

Issue using $.get() with online API

[ Edited ]

Alright, this is my first beg for help in WebWorks dev. I hope I can be clear and that someone can help me!

 

I'm developing a Client application for my Web service at http://tncr.ws (its a URL shortening service), and in my webworks app I'm attempting (at this point) to just connect to the api and use Alert() to display what $.get() gets from the server.

 

The app is signed.

 

Jquery is being used and called in my html:

 

<script type="text/javascript" src="js/jquery_min.js"></script>

 

 

Heres my Javascript function:

 

function GetAPI(ourl,em,ph){
$.get("http://tncr.ws/api.php", { apiv: "123456", key: "1234567", IP: blackberry.identity.PIN, s: ourl, email: em, phone: ph }, function(data){ alert("Result: " + data); });
}

 Here's the part of my page that calls the function:

<TABLE>                
<TR><TD>URL:</TD><TD><INPUT TYPE="textbox" NAME="url" ID="url" VALUE="" x-blackberry-initialFocus="true"><BR></TD></TR>
<TR><TD>Email:</TD><TD><INPUT TYPE="textbox" NAME="email" ID="email" VALUE=""><BR></TD></TR>
<TR><TD>Phone:</TD><TD><INPUT TYPE="textbox" NAME="phone" ID="phone" VALUE=""><BR></TD></TR>
</TABLE>

<A x-blackberry-focusable="true" onClick="GetAPI(os,oem,oph)"> <IMG src="button.png" ID="STbutton" name="STbutton"> </A>

 The variables in GetAPI() come from 3 input fields directly above it, and are called  as functions actually:

 

function os(){
	var ost = document.getElementById('url');
	if(ost.value == null){ ost = ""; }
return ost.value
}
function oem(){
	var oemt = document.getElementById('email');
	if(oemt.value == null){ oemt = ""; }
return oemt.value
}
function oph(){
	var opht = document.getElementById('phone');
	if(opht.value == null){ opht = ""; }
return opht.value
}

 

Now I'm really confused, because the entire "webapp" works fine in my browser, and I've added this for the access to http://tncr.ws (into the config.xml :

<access uri="http://tncr.ws" subdomains="false"></access>

 And in the config.xml I set rim:connection timeout="999999"

 

 

This is the actions and expected results:

*fill in 3 fields with whatever*

*Click button* - GetAPI runs and uses the $.get() to get the page output from the server, and then alerts with "Result: http://url.comemail@email.comBBPINstapilinks=0,0,0,0,0,0,0,0,0"

 

And so far the page works 100% on my server, but nothing happens at all in the app when used on the device.

 

what gives?

 

UPDATE:

Its working on OS6 on the Bold 9780, but not on the Bold 9000 with OS5.

CEO/Lead Developer - Tensioncore™ Design Studios
http://tncr.ws/ - ShortenThis!™ for Blackberry Playbook | ShortenThis!™ for BlackBerry® 10
The Periodical Toe A highly informative Table of Elements
DrawThis! A fun drawing app for the BlackBerry® PlayBook™!
http://www.tensioncore.com/ - Tensioncore™ Web Hosting
Retired
tneil
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Issue using $.get() with online API

Hi tensioncore,

 

I'm curious on what the issue turned out to be on OS6 that has now been resolved??  

 

Also I noticed that you had configured the connectionTimeout in the config.xml file... have you modified your Transport order selection?

 

Typically we recommend that people don't adjust these settings unless there is a specific need.  They have a bunch of different complex routing tables that are associated with them.

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Developer
tensioncore
Posts: 326
Registered: ‎12-13-2010
My Device: Bold 9900/Z10 Special Edition

Re: Issue using $.get() with online API

[ Edited ]

Hi, thanks for the reply!

 

To answer your first question, in OS6 on the Bold 9780, It started working after I put x-blackberry-focusable="true" in both the < A > as well as the < IMG > tags.

 

In OS5 on the Bold 9000, when clicked, nothing happens.

 

I have a new issue too, on the Storm with OS5, when I touch the button, nothing even happens, and the mouse over effect that I have on the button doesn't work, nor does is run the function/send the form data...

 

Regarding the connectionTimeout, I changed the order only as an experiment to see if something else would work. After changing the actual connectionTimeout= to 999999 was the first time I had any network connectivity/activity.

CEO/Lead Developer - Tensioncore™ Design Studios
http://tncr.ws/ - ShortenThis!™ for Blackberry Playbook | ShortenThis!™ for BlackBerry® 10
The Periodical Toe A highly informative Table of Elements
DrawThis! A fun drawing app for the BlackBerry® PlayBook™!
http://www.tensioncore.com/ - Tensioncore™ Web Hosting
Developer
tensioncore
Posts: 326
Registered: ‎12-13-2010
My Device: Bold 9900/Z10 Special Edition

Re: Issue using $.get() with online API

Anybody?
CEO/Lead Developer - Tensioncore™ Design Studios
http://tncr.ws/ - ShortenThis!™ for Blackberry Playbook | ShortenThis!™ for BlackBerry® 10
The Periodical Toe A highly informative Table of Elements
DrawThis! A fun drawing app for the BlackBerry® PlayBook™!
http://www.tensioncore.com/ - Tensioncore™ Web Hosting
Retired
tneil
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Issue using $.get() with online API

Is the onclick not even firing?  so if you just did an alert() in the onclick does it fire?

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