0

我正在尝试通过 JQuery ajax 函数调用此 php 脚本。它只是返回状态 0 错误?我可能是网址或其他东西,但我不太确定。有什么建议么?

 php:

    <?php 
    require_once('classes/DbH.php');
    $dbh = new Dbh('signatur_stories');
    $dbh->query("set names utf8;");
    $videoUrl = $_GET['videourl'];
    echo 'jeg er et php script!!';

    if(isset($videoUrl) && !empty($videoUrl)){

        $sql = sprintf('UPDATE podcast SET isValidated=1 WHERE url="%s"', $videoUrl);  
        $dbh->query($sql);        
    }

?>

JS:

function validateVideo(){
        alert(player.currentSrc.substring(57));
        $.ajax({ url: '/../inc/validatePodcast.php',
             type: 'get',
             data: 'videourl=' + player.currentSrc.substring(57),
             success: function() {
                 alert("hej");
                       window.location.href="../staff/admin.php";  
                      },
            error: function(jqXHR, exception) {
                if (jqXHR.status === 0) {
                    alert('Not connect.\n Verify Network.');
                } else if (jqXHR.status == 404) {
                    alert('Requested page not found. [404]');
                } else if (jqXHR.status == 500) {
                    alert('Internal Server Error [500].');
                } else if (exception === 'parsererror') {
                    alert('Requested JSON parse failed.');
                } else if (exception === 'timeout') {
                    alert('Time out error.');
                } else if (exception === 'abort') {
                    alert('Ajax request aborted.');
                } else {
                    alert('Uncaught Error.\n' + jqXHR.responseText);
                }
            }
        });
    }
4

1 回答 1

1

网址:' /../inc / validatePodcast.php'

那是对的吗?

于 2013-06-11T20:02:13.973 回答