Forums

Posting in these forums is disabled. These forums will be available for archive purposes. Please join the new forums at the links below:

  • yui-support - replaces the `YUI 3.x` and `YUI 3 Gallery` forums.
    We have created the following discussion categories within this group to aid discoverability for these most-used topics:
    • Charts for YUI Charts support.
    • DataTable for YUI DataTable support.
    • Gallery for YUI Gallery support, including support for published Gallery components as well as the Gallery process in general.
    • Tools for support of YUI’s suite of developer tools such as selleck, shifter, grover, yogi, etc.
    • Everything Else for questions that don’t fit one of the categories above, we’ve got you covered here.
  • yui-deprecated - replaces the `YUI 2.x` forum and the forums of other deprecated products (`YUI Doc`, `Builder`, `YUI PHP Loader`, etc.).
  [ 3 posts ]
New Topic | Post Reply | Print view
Previous topic | Next topic

Rahul

  • Username: rahul8590
  • Joined: Thu Mar 29, 2012 6:21 am
  • Posts: 2
  • GitHub: rahul8590
  • Gists: rahul8590
  • IRC: rahul
  • Offline
  • Profile
Tags:
  • chrome
  • console
  • datasource
  • json
  • utility

Unable to fetch Data using Data Source

Post Posted: Thu Mar 29, 2012 6:38 am
I have wriiten a very small snippet using DataSource Utility to fetch data from URL . The problem is everytime i try executing the script , i get failure alerts. On debugging thru chrome console , i see the data source request is not even made to the url .

The following is the code
Code:


       var myDataSource = new YAHOO.util.DataSource("http://hostname.com:8590/status?");
   myDataSource.responseType = YAHOO.util.DataSource.TYPE_TEXT;
      
        var mySuccessHandler = function() {
            alert(myDataSource);
      };
       
   var myFailureHandler = function() {
                       alert("failure");
                      alert(myDataSource);
      };
       
   var callbackObj = {
          success : mySuccessHandler,
          failure : myFailureHandler
   };

        myDataSource.sendRequest("job=1f179700-770f-11e1-9d97-458a3dcf55be",  callbackObj);





If the repose type is json and if i use type_text . Will the datasource throw an error ?
Is there any other way to fetch text from a particular url ?

Satyam

YUI Contributor

  • Username: Satyam
  • Joined: Tue Dec 09, 2008 12:34 am
  • Posts: 2017
  • Location: Sitges, Spain
  • GitHub: Satyam
  • Gists: Satyam
  • IRC: DevaSatyam
  • YUI Developer
  • Offline
  • Profile

Re: Unable to fetch Data using Data Source

Post Posted: Thu Mar 29, 2012 8:44 am
Since you are using a full URL in the DataSource constructor, I assume your source of data lies in a different server than your pages. The browser will not allow cross-domain requests using the standard communication layer.

The response type would be relevant if you had any response, which you don't.

Rahul

  • Username: rahul8590
  • Joined: Thu Mar 29, 2012 6:21 am
  • Posts: 2
  • GitHub: rahul8590
  • Gists: rahul8590
  • IRC: rahul
  • Offline
  • Profile

Re: Unable to fetch Data using Data Source

Post Posted: Thu Mar 29, 2012 8:48 am
so how do i do cross browser request then ? Isnt there any work around for this ? or any other utilitiy apart from Data source which will allow me to do so ?
  [ 3 posts ]
New Topic | Post Reply | Print view
Previous topic | Next topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum