我对此很陌生,无法弄清楚我出错的地方。当我点击按钮时,什么都没有发生。我可能会增加太多额外的东西,我无法确定。任何帮助是极大的赞赏。我在这段代码中遗漏了什么?
<META HTTP-EQUIV="Content-Script-Type" CONTENT="text/javascript" />
<html ng-app>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="victory.js"></script>
<script language="javascript" type="text/javascript">
var Walmart = (function() {
function Walmart(http, zone) {
this.stores = [];
this.storeid = document.getElementById("storenum").value
this.walmart = {
query: [
'http://search.mobile.walmart.com/search?query=',
'&store=' + this.storeid
],
};
this.zone = zone;
this.http = http;
console.log(this.walmart);
};
var query = document.getElementById("search").value;
Walmart.prototype.getWalmartStoreQuery = function (query) {
return this.http.get(this.walmart.store.query[0] + query + this.walmart.store.query[1]).map(function (res) { return res.json(); });
</script>
<tr>
<td><input type="text" name="storenum" id="storenum"></td>
<td><input type="text" name="search" id="search"></td>
</tr>
<tr>
<td><button onclick="getWalmartStoreQuery">Test</button></td>
</tr>
检查控制台是否有错误信息? –
自带作为一个错误的唯一的事情是“GET /favicon.ico”错误(404):“未找到” – MrKane123
所以没有错误消息,当您单击该按钮? –