SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Apr 2011
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    "Was this helpful" script

    Hey guys,

    I'd like to have a "was this helpful" script on my review site, so people can say whether they find a review helpful. I know this is going to require a mix of AJAX and php but I'm a JS newbie and was hoping someone knows of pre-made script I could use for this. Anyone know of one?

    Thanks,

    Chris

  2. #2
    SitePoint Enthusiast
    Join Date
    Sep 2010
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've never done this before however, if I were going to attempt it, I would only use AJAX and PHP.

    I think you would have to have a 'was this helpful' link that calls an ajax function. The ajax function would go to a php page that would basically update a database each time someone clicked helpful.

    If you had 2 choices (helpful or not helpful) you would have 2 columns and when displaying the result you could see which was greater of the 2 and display that as the result

    ex:
    Code:
    Col 1 (helpful)         Col 2 (Not Helpful)
    
          55                             20

    Here you would use a php script to compare the 2 numbers and, as helpful is greater than not, display 'users thought this was helpful'

    Anyway, hopefully that's what you were asking. I don't think javascript would have much role other than calling the XMLHTTPrequest object for the ajax call.

  3. #3
    SitePoint Member
    Join Date
    Apr 2011
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks sd_js, very helpful. Yes, I think I'm just going to have to write this myself, no big deal.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •