function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
finalistfinalist 

Calling an internal webservice from within a function (from hackathon)

I created a VF page at the DF09 Hackathon last year to pull in a list of Twitter posts and display it on a VF page, and I'm finally getting around to extending it to capture the list details.  I want to call out to an Apex WebService class that will create new objects based on the feed.

 

The WebService takes the details of my item (the twitter username and message) and returns either 0 or 1, based on whether the record was successfully created or not.

 

Prior to this latest change, the list is generated and displayed inline; after I added the call, the page writes one tweet and stops. 

 

Any help is appreciated!

 

 

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
  <script>
  
  $(document).ready(function(){
  
    $.getJSON("http://search.twitter.com/search.json?callback=?&q={!Twitter_Campaign__C.hashtag__c}",
        function(data){
        
        //console.log(data);
        
          $.each(data.results, function(i,item){
            $("<div>").html("<img src=\"" + item.profile_image_url + "\" />@" + item.from_user + ": " + item.text).appendTo("#results");


    // *** Here's the attempt to call out to my WebService ***
    compareResult = logTweets.createTweet(item.from_user, item.text);

        
          });
          
        });

  });
  </script>

 

 

finalistfinalist

Based on suggestions from a trusted advisor (and SF APEX/VF trainer), I'm going to rework this as an Apex callout.  I'll let you know how it works out.