i do have 3 input text which are of "type:number" and a save button. i want to insert the these 3 input text data into the database using ajax. i have written the code as follows:
<fieldset><legend>Response Times</legend></fieldset>
<form class="form">
<div class="control-group">
<label class="control-label">High Priority</label>
<div class="controls">
<input type="number" name="high" id="sval"/>Days
</div>
</div>
<div class="control-group">
<label class="control-label ">Low Priority</label>
<div class="controls">
<input type="number" name="high" id="sval"/>Days</div>
</div>
<div class="control-group">
<label class="control-label ">Normal</label>
<div class="controls">
<input type="number" name="high" id="sval"/>Days </div>
</div>
<button id="insert" class="btn btn-primary">Save</button>
</form>
<script type="text/javascript" src="<?php echo $BASE;?>scripts/data/projects_service.js"></script>
and my query is
Insert into app_settings(kunnr,skey,sval) Values ('0001000383','hp_days','1')
Insert into app_settings(kunnr,skey,sval) Values ('0001000383','lp_days','3')
Insert into app_settings(kunnr,skey,sval) Values ('0001000383','np_days','2')
which are hard coded but i dont want hard coded data.my problem is that only sval values are showing in the view but what about this skey value.and i want o insert it using ajax and i have tried this by ajax that i have written as follows:
$(function () {
$("#insert").click(function () {
var id = $("#id").val();
var sval = $("#sval").val();
$.post(root + "data/projects_service?json", { pid: id, sval: sval }, function (data) { });
});
});
please suggest me on this..