php - how to retrive value from jquery ui slider and store them into database? -


hi im new javascript , ajax. problem when move slider value,the value should stored database , response should value stored. have searched many questions asked here still cant figure out yet. great.

here html code

<head> <script> $(function() {     $( "#slider-range-max" ).slider({         range: "max",         min: 1,         max: 10,         value: 2,         slide: function( event, ui ) {             $( "#amount" ).val( ui.value );         }     });     $( "#amount" ).val( $( "#slider-range-max" ).slider( "value" ) );      $.ajax({         type:"post",         url:"myslider.php",         data:"vote="+$( "#slider-range-max" ).slider( "value" ),         success:function(response) {             alert(voted);         }      }) });  </script> </head> 

and myslider.php connection of database,

<?php require 'connection.php'; $vote="";  if (isset($_post['slider'])) {     $vote=$_post['slider'];          mysqli_query("insert slider (value) values ('$vote')"); } ?> 

you need use change callback slider. can correct value , post jquery ajax.

$( ".selector" ).slider({    change: function( event, ui ) {       //here can post data php    } }); 

and omikron43 right. need check parameter expecting in php, because not match sending.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -