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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Contributor
Posts: 23
Registered: ‎06-07-2013
My Device: DTEK50, Q10 , Playbook, Curve 9320
Accepted Solution

xmlhttprequest or other way

Hi,

I want to make this simple app wich basically just shows a text and a date, returned by accessing php web page on the web wich takes in 3 parameters in the URL. http://url?=param1&param2&param3.

I tried with xmlhttprequest but I just hit the cross domain restriction and I'm looking for an alternate way.

 

Any ideas ?

Retired
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: xmlhttprequest or other way

Here is a sample that demonstrates how to use XHR:

http://blackberry.github.io/WebWorks-Samples/kitchenSink/html/browser/xhr.html

 

In order to enable cross-domain reqeusts, you would need to declare an <access> element in your WebWorks application config.xml file for the domain(s) you wish to access.

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.
Contributor
Posts: 23
Registered: ‎06-07-2013
My Device: DTEK50, Q10 , Playbook, Curve 9320

Re: xmlhttprequest or other way

Hi and thanks for the link.

It helped me and I got my first app using XMLHTTP working.
I am now working on how to retrieve and display only a part of the HTML page served by the server asked with XMLHTTP. The page returns a table with no ID, just a class="table_data" and I want to display to the user only the text contained in that table.
I read something about using document.getElementById but my wanted content does not have an ID to hook on, just a class and text with <b></b> tags.

Do you have any suggestions for me ?
Retired
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: xmlhttprequest or other way

You can select an element by its class name like this:

 

var elements = document.getElementsByClassName("table_data");

var num = elements.length; //should only be 1

var first = elements[0];

 

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.