0

我有那个代码:

$(function(){
    $("#dirr").click(function(){
        $("section[name=files]").load('pages/files.php?' + $.param({dir: 2}););
    });
});

和页面上的错误:

Fatal error: Call to a member function prepare() on a non-object in \pages\files.php on line 51

更新:

<?
if($_GET['dir'] == ""){
    echo '<form id="dirform" method="POST" action="?f=createdir">
            <label>Create directory:
            <input type="text" id="cdir" name="cdir" required>
            <input type="radio" name="dirpub" id="dirpub" value="1" checked>Public
            <input type="radio" name="dirpub" id="dirpub" value="0">Private
            <input type="submit" value="Create !">
            </label></form>';
    $sth = $pdo->prepare("SELECT * FROM directories WHERE id_dono=:iddono");
    $sth->bindParam(":iddono", $linha["id"]);
    $sth->execute();
    while($row = $sth->fetch(PDO::FETCH_ASSOC)){
        if($row["public"] == 1){
            $status="Public";
        }else{
            $status="Private";
        }
            echo '<div id="dir" class="4u">
        <article class="item"><script>
$(function(){
    $("#dirr").click(function(){
        $("section[name=files]").load(\'pages/files.php?dir='.$row["id"].'#files\');
    });
});
</script>
            <a href="javascript:void(0);" id="dirr" class="image full"><img src="'.$row["icon"].'" alt="" /></a>
            <header>
                <h3>'.$row["name"].' - '.$status.'</h3>
            </header>
        </article>
    </div>'; 
    }
}

它还没有完成,我需要那个链接工作。我改变了

$("section[name=files]").load('pages/files.php?' + $.param({dir: 2}););

至:

$("section[name=files]").load(\'pages/files.php?dir='.$row["id"].'#files\');

4

1 回答 1

0

尝试改变这个:

$.param({dir: 2});

对此:

$.param({dir: 2})

我所做的是删除分号!=)

于 2013-11-08T16:59:54.640 回答