Help getting stated, Jquery and PHP MVC app

Help getting stated, Jquery and PHP MVC app

 Hey all, I am an absolute Javascript/JQuery noob.  I have however, seen enough tutorials to get the basics on it and have been able to throw together a short script for submitting a form.  Please excuse my code if it's messy, I really don't know javascript (I can read it pretty good though).

Anyways, I have a basic script written to use a bit of ajax on my form.  Note that I am using a PHP MVC app.  I wanted to send the request to a method in my app, but it fails every time I try.  I can however send it to a php script outside of the MVC app (although even if that script always returns false I still get success from JQuery).

Here is my Jquery...

   
  1.  $(document).ready(function(){

    // Hide status message by default
    $(".error").hide();
    $("#error").hide();
    $("#success").hide();

    // Create content
    $("#submit").click(function(){

    // Hide status message by default
    //$("#error").hide();
    //$("#success").hide();

    var hasError = false;

    // Check that we have a title
    var title = $("#title").val();
    if(title == '') {
    $("#title_error").show();
    hasError = true;
    }
    // Check that we have a url
    var url = $("#url").val();
    if(url == '') {
    $("#url_error").show();
    hasError = true;
    }
    // Check that the full story and short story was not left blank
    var short = $('#short').val();
    var full = $('#full').val();
    if(short == '' && full == '') {
    $("#short_error").show();
    $("#full_error").show();
    hasError = true;
    }
    // Get form data
    var formData = $('#create_form').serialize();

    // Check that we dont have errors
    if(hasError == false) {
    $(this).hide();

    $.ajax({
    type: "POST",
    url: "http://localhost/framework2/public/js/ajax/php/content_create.php",
    data: formData,
    cache: false,
    success: function(){
    $('#success').fadeIn("slow");
    },
    error: function() {
    $('#error').fadeIn("slow");
    }
    });
    }
    else {
    $('#error').fadeIn("slow");
    $(this).show();
    }
    return false;
    });
    });





























































At the moment, my php script simply returns false. I have tried checking for $_POST, $_GET and returning false if none found either. No matter what I do, it is always successful. I would really like to use this within the MVC app itself, that way I can reuse my database instance as well as access my helper files and other libraries. This is a custom framework I am using.

The page I am trying to send to is like http://www.site.com/content/create_page, where create_page is actually a public method of a class. Thanks for any help anyone here can give me, I would really like to leave Xajax behind in favor of JQuery but I don't think I am getting it right.