How To Get Total Diggs Using JQuery And ASP In 30 Lines Of Code


/ Published in: jQuery
Save to your folder(s)

Learn how to retrieve a specific url's total number of Diggs using JQuery, ASP and the Digg API.


Copy this code and paste it in your HTML
  1. <%
  2. Set objXML = Server.CreateObject("Microsoft.XMLDOM")
  3. objXML.Async = False
  4. objXML.SetProperty "ServerHTTPRequest", True
  5. objXML.ResolveExternals = false
  6. objXML.ValidateOnParse = false
  7. objXML.preserveWhiteSpace = false
  8. objXML.Load("http://services.digg.com/stories/?&appkey=" & Server.URLEncode("http://www.example.com/") & "&type=xml&link=" & request.QueryString("url"))
  9.  
  10. Set objRoot = objXML.documentElement
  11.  
  12. Set objItems = objRoot.getElementsByTagName("story")
  13.  
  14. For Each objItem in objItems
  15. temp = objItem.getAttribute("diggs")
  16. Next
  17.  
  18. Set objRoot = Nothing
  19. Set objItems = Nothing
  20.  
  21. response.Write(temp)
  22. %>
  23. <script type="text/javascript">
  24. $(document).ready(function(){
  25. $.get("digg.asp?url=http://www.example.com/", function(data){
  26. $("#digg").text(data);
  27. });
  28. });
  29. </script>
  30. <p>Digg: <span id="digg"></span></p>

URL: http://www.nealgrosskopf.com/tech/thread.asp?pid=35

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.