我的网址是这样的,我想在网址中传递itemid
http://localhost/today/screen.php?itemId=Rose+Petal
我想要像这样的网址
http://localhost/today/screen.php?itemId=1
如果传递itemid in hidden而不是传递所有id但我想只传递url中的itemid如何可能
{section name="sec" loop=$itemArray}
<input type="submit" class="btn" value="{$itemArray[sec].itemNm}" name="itemId" onclick="getorder();">
{/section}
答案 0 :(得分:0)
您可以使用'href'提供特定链接并将其设置为按钮。
在你的情况下,它可以这样做:
@XmlAccessorType(XmlAccessType.FIELD)//lets you decide the fields
@XmlRootElement(name="algorithm")
public class Algorithm implements Serializable{
private static final long serialVersionUID = -1L;
@XmlElement(name="prodName")//name of field
private String prodName = null;
@XmlElement(name="prodImages")//name of other field
private String [] prodImages = null;
//getter and setters
}
答案 1 :(得分:0)
试试这个:
jQuery(document).ready(function(){
function getorder(){
var id = jQuery('[name="itemId"]').val();
window.location.href = 'http://localhost/today/screen.php?itemId='+id;
}
});