I have request boxes. they are called from index.cs.asp?
Process=ViewRequests. Then I have forms inside these boxes. All with
same ids #REQUESTFORM. when user clicks submit button (all have
name=respond) in any of these forms I need that form sent to
index.cs.asp?Process=RespondRequests and print server's response.
To use closest, I divided the code into two pieces. However, I think I
still cant grab clicked form 's data. I dont receive any errors but it
grabs wrong form information and does not print back server's
response.
$("[name='respond']").live('click', function() {
$.ajax({
type: "POST",
data: $(this).closest('#REQUESTFORM').serialize(),
url: "content/requests/index.cs.asp?Process=RespondRequests",
success: function(output) {
$('#REQUESTFORM').html(output);
},
error: function(output) {
$('#REQUESTFORM').html(output);
}
});
});
$(function Requests() {
$.ajax({
type: 'GET',
url: 'content/requests/index.cs.asp?Process=ViewRequests',
success: function(data) {
$("#requests").html(data);
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
$("#requests").html('.');
}
});
});