page_view.js 708 B

1234567891011121314151617181920212223242526272829303132333435
  1. var config = {
  2. "blogRequestHost": "http://blogScript.5tangs.com"
  3. }
  4. /**
  5. * getPath
  6. * @returns {string}
  7. */
  8. function getPath() {
  9. var pathname = location.pathname || '';
  10. if (pathname.slice(-1) === '/') {
  11. pathname = pathname.slice(0, -1);
  12. }
  13. var list = pathname.split('/');
  14. return list[list.length-1] || '';
  15. }
  16. function recordView() {
  17. var name = getPath();
  18. // var request = config["blogRequestHost"] + "/view_article?aid" + aid;
  19. $.ajax({
  20. "type": "GET",
  21. "url": config["blogRequestHost"] + "/view_article?",
  22. "data": {
  23. "name": name
  24. },
  25. "dataType": "json",
  26. "error": function (data) {
  27. console.log(data);
  28. },
  29. "success": function (data) {
  30. }
  31. })
  32. }