0

I have a column in a database table that contains several urls and I was wondering what is the best way to get these urls from the database table into a javascript function.

Example code of how to approach this would be much appreciated.

Thanks.

3
  • I have attempted an answer, but really we could do with more information about how the URLs are held in the table and what you want to do with them in Javascript. Commented Jun 29, 2010 at 10:23
  • Hi Tony, the URLs are stored as google.com and what I would like to do is take say a select few of these urls, say 4 of them and add them to an array in javascript, i.e. [ "google.com" ,"yahoo.com" , "sun.com" ,"ebay.com"] Just wondering how this would be possible. Thanks. Commented Jun 29, 2010 at 10:33
  • Tony, if you get a chance, could you pls see if you can help with: stackoverflow.com/questions/3141460/… Thanks Commented Jun 29, 2010 at 14:10

1 Answer 1

0

If you can get the URLs into page items via PL/SQL code then you can access the page item values from Javascript like this:

url1 = $v('P1_URL1');
url2 = $v('P1_URL2');

For example, you could have an on-load PL/SQL process like:

select url1, url2
into   :p1_url1, :p1_url2
from   my_urls
where  ...;

To put several URLs into an array you could use the PL/JSON library - see this example. Again, this would be PL/SQL code to put the JSON array into a page item which you can then access from Javascript using v$(). Or you could use AJAX as descrobed here.

Sign up to request clarification or add additional context in comments.

1 Comment

Hi Tony, pls see my response to your query above.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.