Guest User

Untitled

a guest
Jan 16th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. var post_id = 112;
  2. action = 'views';
  3. $.ajax({
  4. url: 'index.php',
  5. type: 'post',
  6. data: {
  7. 'action': action,
  8. 'post_id': post_id
  9. },
  10. success: function(data){
  11. res = JSON.parse(data);
  12.  
  13. }
  14. });
  15.  
  16. // this is resulting as follows
  17. // responseText: "<!DOCTYPE html>↵<html lang="en-US" class="no-js">↵.....
  18. // and getting error as
  19.  
  20. /* Uncaught SyntaxError: Unexpected token < in JSON at position 0
  21. at JSON.parse (<anonymous>)
  22. at Object.success (<anonymous>:9:16) */
Add Comment
Please, Sign In to add comment