butteff
butteff

Reputation: 127

javascript or jquery simple code

I have a problem. I don't know JavaScript or jQuery; only HTML, CSS, PHP, and design. I need a simple jQuery function, but I don't know how to do it.

I need to make a call to the following webservice:

This function returns a number near ')'. I need to display this number in <div id="count">.

How do I do that? Can you help me?

Upvotes: 1

Views: 160

Answers (1)

Oscar
Oscar

Reputation: 766

Because of restriction due to crossdomain policy you probably need get the data through jsonp. Luckily this is easily done with jQuery.

$.getScript("http://vkontakte.ru/share.php?act=count&url=http://viberieto.ru/");

This will create a new script tag containing the code returned by the webservice. To handle the response you'll need to create a object structure like the one from the url:

var VK = {
  Share: {
    count: function(arg1, arg2) {
      // Insert the value into the div
      $('#count').html(arg2);
    }
  }
};
VK

Edit: Fixed typo

Upvotes: 4

Related Questions