Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have to load data for a different url the page will run on the android browser and will load content from remote server . I have to use dojo so I tried with dojo.xhrGet , it does'nt load the data so when I red the reference guide I saw that that method has some limitation with external url's . So what I have to do now if I have to call a REST service with dojo . the REST service URL on the remote server:

http://192.168.1.65:9080/RAD8JAX-RSWeb/jaxrs/customers/accounts/111-11-1111/

and the data that I should see

[{"id":"001-111001","balance":12345.67},{"id":"001-111002","balance":6543.21},{"id":"001-111003","balance":98.76}]

please help me with a method that can fix my problem I dont know dojo well I'm blocked right now because I can't use the data between two application they can't communicate

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
204 views
Welcome To Ask or Share your Answers For Others

1 Answer

Your question is unclear, but I think you are saying you want to load data from a different domain to the main web page.

You cannot reliably use AJAX to load data from anywhere other than the domain of page you are visiting. Almost all modern internet browsers deliberately block that, for the protection of their own users.

Instead, you will need to find some way of getting your server to relay the information.

So imagine currently you do:

  • Load page a.example.com/index.html
  • Page uses dojo to try to load b.example.com/data

You would instead need to do:

  • Load page a.example.com/index.html
  • Page uses dojo to try to load a.example.com/data
  • When the a.example.com server receives a request to load /data, it should connect (perhaps using cURL) to b.example.com/data and then output the same text.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...