I am not sure why the jQuery form plugin success callback function is not executing. Why is the callback not executing and how do I execute the callback?
code:
<script type="text/javascript">
$(document).ready(function() {
var insertOptions =
{
// other available options:
url: 'manage_livestock/insert_livestock',
type: 'post',
dataType: 'json',
clearForm: true,
//resetForm: true
// $.ajax options can be used here too, for example:
timeout: 3000,
success: showResponse
};
$("#livestock").ajaxForm(insertOptions);
});
function showResponse(responseText, statusText, xhr, $form)
{
alert('status: ' + statusText + '\n\nresponseText: \n' + responseText +
'\n\nSuccess!');
}
</script>
-Rich
As I proposed in the comments - the response should be a valid json
, otherwise you could change the type to html
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With