nikku/jquery-bootstrap-scripting

Problem POSTing AJAX form

Closed this issue · 1 comments

Hi, I'm using TwitterBootstrap+JQuery+Dialog2 with CodeIgniter in the server.
I have this page loaded with your beautiful Dialog2:

<!DOCTYPE html>
<html>
<head>
    <title>Invia Newsletter di Prova</title>
</head>
<body>
    <h1>Invia Newsletter di Test</h1>

    <?if(isset($error)):?>
        <div class="alert alert-error">
            <span class="close" data-dismiss="alert">×</span>
            <h4 class="alert-heading">Attenzione!</h4>
            <?=$error?>
        </div>
    <?endif;?>
    <?if(isset($message)):?>
        <div class="alert alert-info">
            <span class="close" data-dismiss="alert">×</span>
            <h4 class="alert-heading">Informazione:</h4>
            <?=$message?>
        </div>
    <?endif;?>

    <p>some-text</p>

        <form action="/admin/news/<?=$id?>/test.html" method="post" accept-charset="utf-8" class="ajax inline-form">
        <fieldset>
            <input type="text" name="addresses"  class="span6"/><br>
            <span class="help-inline">text  </span>
        </fieldset>

        <div class="form-actions">
            <input type="submit" name="submit" value="Invia Test" class="btn btn-primary" />
            <a class="btn close-dialog" href="#">Close</a>
        </div>
    </form>
</body>
</html>

And this is the JS code that i'm using for the Dialog2:

    $.fn.dialog2.defaults.autoAddCancelButton = false;
    $(".modal-ajax-trigger").click(function(event) {
        event.preventDefault();

        var id = $(this).attr("data-id");
        var mTitle = $(this).attr("modal-title");
        var href = $(this).attr("href");

        $('<div/>').dialog2({
            title: mTitle, 
            content: href, 
            id: "modal-ajax-landing-data",
            showCloseHandle: false,
            removeOnClose: true, 
            closeOnOverlayClick: true,
            showCloseHandle: false,
            initialLoadText: "Caricamento in corso...",
        }).dialog2("removeButton", "Cancel");
    });

But when i submit the form it just loads the new page outside the dialog ignoring the form.ajax .
I haven't figured out why.
Using Chrome 20.0.1132.47 under Mac and no error found in the js console.
Can you help me or just giude me where the problem could be?
Thanks,
esolitos

Missing Dependencies.