javascript - php jquery voting system -


I am trying to implement a simple voting system. My page has a list of promos, people can vote Are there. I like a voting link -

  & lt; Button rel = "promo_vote" id = "promo_vote!   

After clicking on it, the data will be filled in the database for that particular promo and I used a button style to use it as a voting counter. I'm trying to increase its value dynamically. The DB entry is going on completely but the counter does not increase. It seems that this button is not able to recognize. Show me your jquery code.

  $ ("[rel = promo_vote"]. Click (function () {var p = jQuery ( this); var id_vote_promo = p.attr ("id"); var post_id_of_promo = id_vote_promo.substring (id_vote_promo.indexOf ('!') + 1); var datestring = 'post_ id_of_promo =' + post_id_of_promo; var id_unvote_promo = "promo_unvote! "+ Post_id_of_promo; var vote_counter_id =" #vote_counter! "+ Post_id_promo; var value = $ (vote_counter_id) .val (); $ .ajax ({type:" post ", url:" my url to controller ", data: data String, cache: fraud, success: function (value) {value = value + 1; $ (Praise_counter_id) .val (value); $ (p) .replace with ("& lt; button rel = 'promo_unvote' id = '" + id_unvote_promo + "' class = 'more-alt img-circle fa fa-check' title = '' & gt; & lt ; / Button & gt; ");}}); Return return;});   

and the counter code is

  & lt; P class = "nm" & gt; + & lt; Input type = "button" value = "1" class = "vote_count_btn" id = "votegator!   

Can you help me Where am I missing? thank you in advanced.

Try,

  $ (vote_counter_id). Val (value); .val (value) in place of   

  $ (praise_counter_id);    

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -