[jQuery] Submit form using ajax

[jQuery] Submit form using ajax


Hi,
I am loading a form on click of an hyperlink using ajax.after loading
i want to submit that form again with ajax.i tried many methods but no
one is working.i need to do validation also.
i am using this code.
$(document).ready(function(){
     $('#admin_ajax_new_content_id').load('add_prime_shows.php');    //by
default initally load text from boo.php
$('#admin_left_navigation a').click(function() { //start
function when any link is clicked
    $('#admin_ajax_new_content_id').slideUp("slow");
    //    var content_show = $(this).attr("title");
        var href_name = $(this).attr("title");
        $.ajax({
        method: "get",url: href_name,data: "",
        beforeSend: function(){$("#loading").show("slow");}, //show loading
just when link is clicked
        complete: function(){ $("#loading").hide("slow");}, //stop showing
loading when the process is complete
        error: function(){
        $('#loading').hide();
        alert( "Error: while fetching form.");},
        success: function(html){ //so, if data is retrieved, store it in
html
        $('#admin_ajax_new_content_id').slideDown("slow"); //animation
        $('#admin_ajax_new_content_id').html(html); //show the html
inside .content div
                     }
                 }); //close $.ajax(
}); //close click(
// After click of an a link form comes fine.
var options = {
target: '#admin_ajax_message_div', // target element
(s) to be updated with server response
beforeSubmit: validate_prime_show, // pre-submit callback
success: prime_showResponse, // post-submit callback
// other available options:
//url: url // override for form's 'action'
attribute
type: 'post', // 'get' or 'post', override for
form's 'method' attribute
//dataType: null // 'xml', 'script', or
'json' (expected server response type)
clearForm: false // clear all form fields after
successful submit
//resetForm: true // reset the form after successful
submit
// $.ajax options can be used here too, for example:
//timeout: 3000
};
$('#add_prime_show_id').ajaxForm(options);
function validate_prime_show(formData, jqForm, options) {
var queryString = $.param(formData);
var error_status=0;
var showValue = $('input[@name=show_name]').fieldValue();
if (!showValue[0]) {
alert('Please enter show name.');
    error_status = 1;
return false;
}
    if(error_status == 0)
    {
         $('#loading').show();
        return true;
    }
}
// post-submit callback
function showResponse(responseText, statusText) {
$('#loading').hide();
$('#admin_ajax_message_div').fadeOut(5000);
}
But this thing is not working
}); //close $(
Please let me know where i am wrong.