"未终止的字符串文字"在FireFox控制台日志中?

时间:2014-11-18 09:38:52

标签: javascript

我无法理解为什么它会在Firefox控制台日志中显示错误消息。当我加载login.php页面时,它会向我显示一条错误消息:

SyntaxError: unterminated string literal
var rie = '7c5c0f66034a105055511059115603131907460d511059095b1c4c414c6

如果我删除以下脚本,那么它不会显示任何错误消息。所以我确信这是关于脚本问题的全部内容。你能告诉我为什么它会发生这个错误消息,因为我是一个新的Javascript。谢谢你的帮助。

<script type="text/javascript">
 //Hide image on page load
$('#loaderAnim').hide();
$('#login_process').submit(function (event) {
    event.preventDefault();
    $('#loaderAnim').show(); // Show it before making ajax call
    $.ajax({
        type: 'POST',
        url: 'login_process.php',
        data: $(this).serialize(),
        dataType: 'json',
        success: function (data) {
            $('#loaderAnim').hide(); // Hide when done 
            $('#success').html('');
            $.each(data, function (key, value) {
                if (key !== 'error') {
                    $('#success').append('<p>' + value + '</p>');
                }
            });
            if (!data.error) {
                $('#hide').hide();
                setTimeout(function () {
                    $('input[type=submit]').attr('disabled', false);
                    window.location.href = "index.php";
                }, 2000);
            }
        }
    });
});
</script>

更新(login.php页面):

<?php
ob_start();
session_start();
require_once("config.php");
if(isset($_SESSION['front_username']) && isset($_SESSION['front_password']) && isset($_SESSION['user_id'])){
header('Location:users/index.php');
exit();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo SITE_NAME; ?></title>
<link href="style/design.css" rel="stylesheet" type="text/css" />
<link href="style/menu-front.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php require_once("notice.php"); ?>
<div id="wraper">
    <div id="container">
        <div id="content">

<?php require_once("menu.php"); ?>

<h2>Login to manage your contacts.</h2>
<img id="loaderAnim" src="images/loading-image.gif" style="display:none;"/>
    <div id="success"></div>
    <form id="login_process">
    <table width="500" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td>Username</td>
        <td><input type="text" name="front_username" placeholder="Username" maxlength="20" /></td>
      </tr>
      <tr>
        <td>Password</td>
        <td><input type="password" name="front_password" placeholder="Password" maxlength="20"/></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td><input type="submit" name="submit" value="LogIn" class="submit"></td>
      </tr>
      <tr>    
        <td colspan="2">Forgot your password ? Click <a href="forgotpass.php">here.</a></td>
      </tr>
    </table>
    </form>

<script src="http://code.jquery.com/jquery-1.9.0.js"></script>
<!--<script src="include/function.js" type="text/javascript"></script>-->

<script type="text/javascript">
//Hide image on page load
$('#loaderAnim').hide(); 

$('#login_process').submit(function(event) {
event.preventDefault();

$('#loaderAnim').show(); // Show it before making ajax call
$.ajax({
type: 'POST',
url: 'login_process.php',
data: $(this).serialize(),
dataType: 'json',      

success: function (data) {
   $('#loaderAnim').hide(); // Hide when done 
   $('#success').html('');
   $.each( data, function( key, value ) {

    if(key !== 'error') {
            $('#success').append('<p>'+value+'</p>');           

    }  
}); 


    if( ! data.error) {     
        $('#hide').hide();              
         setTimeout(function () {
         $('input[type=submit]').attr('disabled', false);        
           window.location.href = "index.php"; 
    },     2000); 
        }

   }
});

});

</script>


<?php require_once("include/footer.php"); ?>


        </div><!--content-->
    </div><!--container-->
</div><!--wraper-->

</body>
</html> 

0 个答案:

没有答案