I'm passing a value to codeigniter function for getting a result. But the ajax value does not pass to the php function.
My script function follows :
<script src="http://ift.tt/1rKdStd"></script>
<Script>
$(document).ready(function() {
$("#up").on('click',function(){
if ($("#incdec").val() < $(this).data("max")) {
$("#incdec").val(parseInt($("#incdec").val())+1);
}
});
$("#down").on('click',function(){
if ($("#incdec").val() > $(this).data("min")) {
$("#incdec").val(parseInt($("#incdec").val())-1);
}
});
});
$(document).ready(function() {
$(".butt").on('click',function(){
var e=$(".aa").val();
alert(e);
$.ajax({
type:"POST",
data:"id="+e,
url:"<?php echo site_url('pages/getit');?>",
success: function(html){
$('#'+dataprocess).html(html);
}
});
});
});
</script>
My HTML code :
<input type="text" name="incdec" id="incdec" value="0" class="aa"/>
<input type="button" class="butt" id="up" value="Up" data-max="5" />
<input type="button" id="down" value="Down" data-min="0" class="butt"/>
<div id="dataprocess"></div>
But I'm getting an error as follows:
Uncaught Error: Syntax error, unrecognized expression: #[object HTMLDivElement]
Please help me find my mistake.
Aucun commentaire:
Enregistrer un commentaire