通过新浪网站提供的一个通用接口拿到一个值,然后通过jquery传到服务器
js代码:
<script type="text/javascript" src="myjs/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="http://hq.sinajs.cn/list=sh600872" charset="gb2312"></script>
<script type="text/javascript">
function check1() {
var str=encodeURIComponent(hq_str_sh600872);
alert(str);
$.post("one/login.action", "stockinfo=" +str, callback);
}
function callback(){
} alert(hql_str_sh600872) 是中文的:中据高新,10.95,10.84,11.21,11.52,10.94,11.21,11.22,46111601,520188478,49039,11.21,203900,11.20,23000,11.19,33800,11.18,44700,11.17,66397,11.22,207215,11.23,151600,11.24,190861,11.25,75400,11.26,2010-01-15,15:02:07
html代码:
<input type="button" value="提交" onclick="check1();">;
java代码:
public String testLogin() {
HttpServletRequest request=ServletActionContext.getRequest();
String str=request.getParameter("stockinfo");
String info="";
try {
info= URLDecoder.decode(str,"GBK");
System.out.print(info);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
js代码:
<script type="text/javascript" src="myjs/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="http://hq.sinajs.cn/list=sh600872" charset="gb2312"></script>
<script type="text/javascript">
function check1() {
var str=encodeURIComponent(hq_str_sh600872);
alert(str);
$.post("one/login.action", "stockinfo=" +str, callback);
}
function callback(){
} alert(hql_str_sh600872) 是中文的:中据高新,10.95,10.84,11.21,11.52,10.94,11.21,11.22,46111601,520188478,49039,11.21,203900,11.20,23000,11.19,33800,11.18,44700,11.17,66397,11.22,207215,11.23,151600,11.24,190861,11.25,75400,11.26,2010-01-15,15:02:07
html代码:
<input type="button" value="提交" onclick="check1();">;
java代码:
public String testLogin() {
HttpServletRequest request=ServletActionContext.getRequest();
String str=request.getParameter("stockinfo");
String info="";
try {
info= URLDecoder.decode(str,"GBK");
System.out.print(info);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货