1

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?

1
  • it's not my site. I just want to display number from it url in my site Commented Mar 23, 2011 at 21:12

1 Answer 1

4

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

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

Comments

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.