This is my first time to experience this. I have a jquery script that submit form data to the server(PHP). This script work perfectly while I was using another template but on switching to another template the script stop working correctly. In my effort to know what exactly is wrong I noticed that the $.post is not sending any data to the url.
<script>
$(document).ready(function() {
$("#addvotemate").click(function() {
var vuniq_userid = $("#vuniq_userid").val();
var vmuniq_userid = $("#vmuniq_userid").val();
//alert("I work to this point");
if (vuniq_userid == '' || vmuniq_userid == '' ) {
alert("Request Failed Try Again");
} else {
// alert(vuniq_userid +' '+ vmuniq_userid);
$.post("<?php echo site_url('user/addvotemate'); ?>", {
vuniq_userid1: vuniq_userid,
vmuniq_userid1: vmuniq_userid
}, function() {
alert("Message Sent");
$('#votreq')[0].reset(); // To reset form fields
});
}
});
});
</script>
Am using Codeigniter 3X, Template bootstrap 3, jquery.1.11.1.min.js View:
<div id="votm">
<form id="votreq" name="form" method="POST">
<input type="hidden" id="vuniq_userid"
name="vuniq_userid" value="<?php echo $_SESSION['uniqueID'] ?>">
<input type="hidden" id="vmuniq_userid"
name="vmuniq_userid" value="<?php echo $pid ?>" >
<btn class="btn btn-sm btn-azure btn-icon"
id="addvotemate"><i class="fa fa-fw fa-users"></i> Add Votemate</btn>
</form>
</div>
I need your kind help as I don't even understand how to solve the problem. I have tried different approach but still no luck. I have use jsfidle. Thanks