响应storage.get时出错:SyntaxError:意外的令牌

时间:2017-08-16 17:11:48

标签: javascript php mysql angularjs html5

您好可以告诉我如何解决此错误:

对storage.get的响应出错:SyntaxError:意外的令牌<     at Object.callback(chrome-extension://nkeimhogjdpnpccoofpliimaahmaaome/js/content.js:1:50)     在chrome-extension://nkeimhogjdpnpccoofpliimaahmaaome/js/content.js:1:22 /favicon.ico无法加载资源:服务器响应状态为404(未找到) 我已经多次尝试删除它但不能。 这是我的main.html代码:

enter code here
<!DOCTYPE html>
<html>
<head>
    <title></title>
    <script src = "angular.js"></script>
</head>
<body>
<div ng app = "myApp" ng-controller = "bookController">
    <form>
Book Name:-<input type="text" ng-model="bname" />
Book Author:-<input type="text" ng-model="bauthor" />
Book Price:-<input type="text" ng-model="bprice" />
Book Language:-<input type="text" ng-model="blanguage" />
<input type="button" value="Submit" ng-click="insertData()" />
</form>
</div>
<script>
     var app = angular.module('myApp',[]);
    app.controller('bookController',function($scope,$http){ 
    $scope.insertData=function(){       
    $http.post("insert.php", {
        'bname':$scope.bname,
        'bauthor':$scope.bauthor,
        'bprice':$scope.bprice,
        'blanguage':$scope.blanguage})

    .success(function(data,status,headers,config){
    console.log("Data Inserted Successfully");
    });
        }
         });
</script>

</body>
</html>

这是我的insert.php代码:

<?php 
$data = json_decode(file_get_contents("php://input"));
$bname = mysql_real_escape_string($data->bname);
$bauthor = mysql_real_escape_string($data->bauthor);
$bprice = mysql_real_escape_string($data->bprice);
$blanguage = mysql_real_escape_string($data->blanguage);
mysql_connect("localhost", "root", "root"); 
mysql_select_db("books-library");
mysql_query("INSERT INTO books('book-name', 'book-author', 'book-price', 'book-longuage') VALUES('".$bname."','".$bauthor."','".$bprice."','".$blanguage."')");
?>

0 个答案:

没有答案