Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. $(function() {
  2. $('.report_add').click(function() {
  3. this_id= this.attr("id");
  4. $.ajax({
  5. type: 'POST',
  6. data: 'reportid'+this_id+'=&userid=789',
  7. success: function() { ... },
  8. error: function(){ ... },
  9. url: '/url/',
  10. cache:false
  11. });
  12. });
  13. });
  14.  
  15. this_id= this.attr("id");
  16.  
  17. data: 'reportid'+this_id+'=&userid=789',
  18.  
  19. var this_id= this.id;
  20.  
  21. data: 'reportid='+this_id+'&userid=789',
  22.  
  23. var this_id= $(this).attr("id"); // add a jQuery wrapper
  24.  
  25. data: 'reportid='+this_id+'&userid=789',
  26.  
  27. data: 'reportid'+this_id+'=&userid=789',
  28. //-------------^----------^--------------your '=' sign is at wrong place
  29.  
  30. data: 'reportid='+this_id+'&userid=789',
  31.  
  32. data: {reportid : this_id, userid : 789},
  33.  
  34. $(function() {
  35. $('.report_add').click(function() {
  36. var this_id= this.id; // <---------update this
  37. $.ajax({
  38. type: 'POST',
  39. data: {reportid : this_id, userid : 789}, // <---- and this
  40. success: function() { ... },
  41. error: function(){ ... },
  42. url: '/url/',
  43. cache:false
  44. });
  45. });
  46. });
  47.  
  48. $(function() {
  49. $('.report_add').click(function() {
  50. this_id= $(this).attr("id");
  51. $.ajax({
  52. type: 'POST',
  53. data: 'reportid'+this_id+'&userid=789',
  54. success: function() {
  55. $(this).text('Remove From Favourite');
  56. },
  57. error: function(){ ... },
  58. url: '/url/',
  59. cache:false
  60. });
  61. });
  62. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement