Info not sending through ajax to php file -
i trying have submit button send php file , give popup notification been completed. when run following, gives me notification no info posted. redirects empty search.php no post data. need give popup, submit info, , stay on same page. cant seem figure out what's wrong form
html:
<div class="panel-body"> <div class="row"> <form class="request" action="search.php" method="post"> <div class="col-lg-12"> <form role="form"> <div class="form-group"> <p>wo notations appear @ top of work order screen. submit useful information can provided builders/centerpoint. other importation information may include bricks, scaffles, dogs, or home owners preventing installation. sure include phone numbers if available.</p> <label>information</label> <div><input class="form-control" placeholder="enter information here" type="text" name="comment[]"></div> </div> <button type="submit" name="notation" class="btn btn-default" onclick="addnotation(<?php echo $orow['workorder']; ?>);">submit button</button> <button type="reset" class="btn btn-default">reset button</button> </form> </div> </div> </div>
ajax
<!-- notation --> <script> function addnotation(wo) { jquery.ajax({ type: "post", url: "functions/wonotation.php", data: 'wo='+wo, cache: false, success: function(response) { alert("your notation has been added work order"); } }); } </script>
php (wonotation.php)
<?php include("../../db.php"); $woid = $_post['wo']; $date = date('m-d-y'); $notationsql = "insert comments (workorder, comment, priority, date) values ('".$woid."', '".$_post['comment']."', '1', '".$date"')"; mysql_query($notationsql) or die(mysql_error()); ?>
you should change data this:
data: {wo: wo}
Comments
Post a Comment