I'm working on my first HTML form that performs an AJAX HTTP POST using jQuery. When a user makes a change to an input text field and tabs out of the field I want it to trigger the AJAX call and pass the value of the input field as well as the value from another PHP variable.
Here's the input in question:
<td><input type="text" class="form-control" id="storeManager" name="storeManager" value="Peter McMahon"></td>
I have a PHP variable - $uuid - which I also need to pass to my AJAX script, as well as the value of the input text field.
Here's my script as it currently stands:
<script type="text/javascript">
$(document).ready(function() {
$("#storeManager").change(function(){
$.ajax({
url: "editProject.php",
data: {
storeManager: storeManager,
uuid: uuid
},
success: function(data) {
$("#storeManager").html(data).addClass("has-success");
},
error: function (data) {
$("#storeManager").html(data).addClass("has-error");
}
});
});
});
</script>
I'm new to jQuery and AJAX and have tried everything I can think of but not sure how to add the required parameters?