我正在尝试显示数据库中的项目。共有6件商品。但是,它只能显示第一个项目。但他们能够显示所有6个按钮。我还在最后添加了一张图片,以显示我的页面当前的样子。有什么方法可以解决这个问题吗?我想要显示我的商品图片,描述和价格,然后按下按钮。但截至目前,它显示了第一个项目和6个按钮。
的Javascript
$(document).ready(function () {
showlist();
});
function showlist(userid) {
var url = serverURL() + "/listitems.php";
categorynameID = decodeURIComponent(getUrlVars()["categoryID"]);
var JSONObject = {
"categoryID": decodeURIComponent(getUrlVars()["categoryID"])
};
$.ajax({
url: url,
type: 'GET',
data: JSONObject,
dataType: 'json',
contentType: "application/json; charset=utf-8",
success: function (arr) {
_showitemResult(arr);
},
error: function () {
validationMsg();
}
});
}
function _showitemResult(arr) {
for (var i = 0; i < arr.length; i++) {
$("#lblimagefile").attr("src", serverURL() + "/images/" + arr[i].imagefile); //display profile image
$("#lblitemName").html(arr[i].itemName); //display item name
$("#lblprice").html(arr[i].price); //display price
htmlstring = "<a href='#' class='ui-btn' id='btn" + arr[i].itemID + "'>View Item</a>"; //add a new [Category] button
$("#result").append(htmlstring);
$("#btn" + arr[i].itemID).bind("click", { id: arr[i].itemID }, function (event) {
var data = event.data;
showitem(data.id);
});
}
}
function showitem(itemID) {
//alert(categoryID);
window.location = "showitem.html?itemID=" + itemID;
}
HTML
<div role="main" class="ui-content" id="main-ui">
<img id="lblimagefile" height="100">
<div id="lblitemName"></div>
<div id="lblprice"></div>
<div id="result"></div>
</div>
答案 0 :(得分:0)
添加到htmlstring价格,图片和名称模板。 htmlstring是每个帖子的模板。
HTML:
Caused by: javax.wsdl.WSDLException: WSDLException (at /wsdl:definitions/wsdl:types/xs:schema/xs:schema): faultCode=PARSER_ERROR: Problem parsing 'http://www.w3.org/2003/05/soap-envelope'.: org.xml.sax.SAXParseException: White spaces are required between publicId and systemId.
at com.ibm.wsdl.xml.WSDLReaderImpl.getDocument (WSDLReaderImpl.java:2198)
at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema (WSDLReaderImpl.java:830)
at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema (WSDLReaderImpl.java:864)
at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema (WSDLReaderImpl.java:654)
at com.ibm.wsdl.xml.WSDLReaderImpl.parseTypes (WSDLReaderImpl.java:610)
at com.ibm.wsdl.xml.WSDLReaderImpl.parseDefinitions (WSDLReaderImpl.java:320)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL (WSDLReaderImpl.java:2352)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL (WSDLReaderImpl.java:2338)
at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition (WSDLManagerImpl.java:255)
at org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition (WSDLManagerImpl.java:165)
at org.apache.cxf.tools.wsdlto.core.WSDLDefinitionBuilder.parseWSDL (WSDLDefinitionBuilder.java:80)
at org.apache.cxf.tools.wsdlto.core.WSDLDefinitionBuilder.build (WSDLDefinitionBuilder.java:71)
at org.apache.cxf.tools.wsdlto.frontend.jaxws.wsdl11.JAXWSDefinitionBuilder.build (JAXWSDefinitionBuilder.java:83)
at org.apache.cxf.tools.wsdlto.frontend.jaxws.wsdl11.JAXWSDefinitionBuilder.build (JAXWSDefinitionBuilder.java:60)
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl (WSDLToJavaContainer.java:195)
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute (WSDLToJavaContainer.java:164)
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute (WSDLToJavaContainer.java:412)
at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool (ToolRunner.java:105)
at org.apache.cxf.tools.wsdlto.WSDLToJava.run (WSDLToJava.java:113)
jQuery的:
<div role="main" class="ui-content" id="main-ui">
<div id="result"></div>
</div>