Simplemodal not loading Ajax page correctly

158 views Asked by At

I am using SimpleModal to create popup windows for my site. One of which need to load up a text editor and get data from database to display in the editor. It is working and opens the popup window loads the text editor but once i put and include files or mysql in the page it loads it fails to open. Ok code

Im using to load the link

<a class="edit" style="font-size:16px;color:#CCC;" href="">Edit</a>

Jquery to load the Modal

jQuery(function ($) {
    var contact = {
        message: null,
        init: function () {
            $('.edit').click(function (e) {
                e.preventDefault();

                // load the contact form using ajax
                $.get("../_Includes/edit.php", function(data){
                    // create a modal dialog with the data
                    $(data).modal({
                        closeHTML: "<a href='#' title='Close' class='modal-close'>x</a>",
                        position: ["15%",],
                        overlayId: 'contact-overlay',
                        containerId: 'contact-container',
                        onOpen: contact.open,
                        onShow: contact.show,
                        onClose: contact.close
                    });
                });
            });
        },
        open: function (dialog) {       
            dialog.overlay.fadeIn(200, function () {
                dialog.container.fadeIn(200, function () {
                    dialog.data.fadeIn(200, function () {
                        $('#contact-container').animate({
                            height: h
                        }, function () {
                            $('#contact-container form').fadeIn(200, function () {
                            });
                        });
                    });
                });
            });
        },
        show: function (dialog) {

        },
        close: function (dialog) {
                dialog.overlay.fadeOut(200, function () {
                    $.modal.close();
                });         
        },
    };
    contact.init();
});

The code on the edit page

$output = '<div class="content"><div class="reply" style="display:none;">
</div><form name="editblog" id="editblog" action="#" method="post">
<font color="#FFF"><strong>Title: </strong></font><input name="blogtitle" id="blogtitle" type="text" id="title"  size="80" maxlength="255" value="" /><br /><br />
<textarea cols="60" id="editblogbody" name="editblogbody" rows="20"></textarea><br />
Please separate tages with a <strong>comma</strong>.<br />
<font color="#FFF"><strong>Tags:</strong></font><input name="tags" id="tags" type="text" size="80" maxlength="255" /><br /><br />
<input type="submit" value="Post Blog" />
<span id="blogFormProcessGif" style="display:none;"><img src="../_Images/loading.gif" width="28px" height="28px" alt="Loading" /></span></form></div>
<script>CKEDITOR.replace( "editblogbody" );</script> ';

echo $output;

As soon as i add to my edit page it stops working all together

session_start();
include("../_Scripts/mysql.php");
$sql = mysql_query("SELECT id FROM members WHERE username='$id'") or die(mysql_error());

Can anyone help please??

0

There are 0 answers