0

JQuery ajax関数を介してこのphpスクリプトを呼び出そうとしています。ステータス0エラーを返すだけですか?私はURLか何かかもしれませんが、よくわかりません。助言がありますか?

 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

URL: ' /.. /inc/validatePodcast.php'

あれは正しいですか?

于 2013-06-11T20:02:13.973 に答える