php - Updating via ajax a DB and show the Answer in a Div -


i want kind button on page. have news , there should "hooah!" link (maybe know battlelog, if gamer) update db via update.php. updating fine don´t want whole page reloaded show actual "hooahs". @ moment use form transmit data - transformed submit-button looks link ...

now problem :

i want "battlelog" click , text shows "5 persons gave hooah!"

  • it possible use hooah! "5 persons gave hooah!" link? , when clicked changes "6 persons gave hooah!".

my script :

<script> $(document).ready(function () {     $('#ajax_form{newsid}').bind('submit', function() {         var form = $('#ajax_form{newsid}');         var data = form.serialize();         $.post('index.php?hooah_update', data, function(response) {             document.location.reload();         });         return false;     }); }); </script> 

the form:

    <div style="position: relative; top: -16px; left: 515px;">       <form method="post" id="ajax_form{newsid}" action="#">         <input type="hidden" name="id" value="{newsid}">         <input type="submit" name="submit" value="hooah!" style="background:none; border:0; color:#0099ff; cursor:pointer;">       </form>     </div> 

thx taking ;)

you seem there. instead of:

document.location.reload(); 

you need like:

$("#your_div").html(response); 

the php script have echo out text want.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -