由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
BuildingWeb版 - JavaScript 问题 (转载)
相关主题
在此请教一个关于form里面change action地址的问题有什么好的JavaScript或者jQuery的画图的库吗?
急问,httprequest errorjquery是不是完全取代了javascript
现在网站都要学什么?css,ajax,...?大家现在用什么detect mobile device?
What javascript lib is better?关于JQuery的前途问题
Anybody need help on php/javascript projects?很想找web方面的工作
请教现代网页开发技术都是用css, js吗?HTML问题
问个jquery的简单问题How to do online HTML,XML,DHTML,JavaScript testing?
java网站写好,如何提速?想和一些搞网站的朋友交流一下
相关话题的讨论汇总
话题: javascript话题: xml话题: row话题: find话题: 8722
进入BuildingWeb版参与讨论
1 (共1页)
I**A
发帖数: 2345
1
【 以下文字转载自 JobHunting 讨论区 】
发信人: IAYA (你是我的天使), 信区: JobHunting
标 题: JavaScript 问题
发信站: BBS 未名空间站 (Tue Dec 7 09:27:40 2010, 美东)
比如我需要写JavaScript从一个URL 获取数据, 然后进行处理....
Any quick tip about what should be used to get the data?
Thanks!
s****y
发帖数: 983
2
如果是get方法,可以用string函数提取出来
但是为什么不是直接传到后台呢?不知道你想干什么
I**A
发帖数: 2345
3
//汗, 我主要是对这个Javascript不熟悉, only know the most basics。。。
你说的转入后台是什么意思?我现在要做的就是从一个web service读取xml file,然
后parse and get 数据,画图... JQuery to get http data?
Thanks a lot for your help~

【在 s****y 的大作中提到】
: 如果是get方法,可以用string函数提取出来
: 但是为什么不是直接传到后台呢?不知道你想干什么

s****y
发帖数: 983
4
哦,google 'jquery parse xml'一堆教程
比如这个
http://www.switchonthecode.com/tutorials/xml-parsing-with-jquery
I**A
发帖数: 2345
5
if i write some sort of servlet, and then call it from jsp, would that be
easier?

【在 s****y 的大作中提到】
: 哦,google 'jquery parse xml'一堆教程
: 比如这个
: http://www.switchonthecode.com/tutorials/xml-parsing-with-jquery

s****y
发帖数: 983
6
那是一样的,js解析xml也不难啊

【在 I**A 的大作中提到】
: if i write some sort of servlet, and then call it from jsp, would that be
: easier?

D*J
发帖数: 141
7
如果不是绝对需要在客户端处理(比如有很多 user interactions),还是在server上
好。

【在 I**A 的大作中提到】
: if i write some sort of servlet, and then call it from jsp, would that be
: easier?

b********2
发帖数: 855
8
jquery.ajax + json? 不过貌似不能跨域名
b********2
发帖数: 855
I**A
发帖数: 2345
10
thanks all..
anyone can take a look at my code? I can't push the data into arrays
相关主题
请教现代网页开发技术都是用css, js吗?有什么好的JavaScript或者jQuery的画图的库吗?
问个jquery的简单问题jquery是不是完全取代了javascript
java网站写好,如何提速?大家现在用什么detect mobile device?
进入BuildingWeb版参与讨论
s****y
发帖数: 983
11
each里面的inline函数需要绑定this
.each(function(){}.bind(this))

【在 I**A 的大作中提到】
: thanks all..
: anyone can take a look at my code? I can't push the data into arrays

I**A
发帖数: 2345
12
还是不work啊。
这个firebug debug javascript file为嘛也不work呢, 我设置breakpoint在那个
parseXml function那儿,死活都不能step in..

【在 s****y 的大作中提到】
: each里面的inline函数需要绑定this
: .each(function(){}.bind(this))

I**A
发帖数: 2345
13
不好意思,你能不能再帮我看一下,我对界个javascript实在是太低手了,问题愚昧,请勿见笑。。
那个link里出来的XML数据主要部分是下面这部分,我就是要把这个日期和数据取出来(这个XML FILE格式有没有问题??)


20101108
3.405


20101109
3.433


20101110
3.546


20101111
3.548


20101112
3.607


code呢就是如下了,加上了bind(this)还是不行, 然后我那个attr我都试了,也没有数据到数组里去, 多谢多谢~~
var chartdates = new Array();
var chartdata = new Array();
$(document).ready(function()
{
$.ajax({
type: "GET",
url: "http://host:8080/Charting/",
dataType: "xml",
success: parseXml
});
});
function parseXml(xml)
{
$(xml).find('row').each(function()
{
//chartdates.push($(this).find('x').text());
//chartdata.push($(this).find('y').text());
chartdates.push($(this).attr('x'));
chartdata.push($(this).attr('y'));
}.bind(this));
};

【在 s****y 的大作中提到】
: each里面的inline函数需要绑定this
: .each(function(){}.bind(this))

s****y
发帖数: 983
14
数组定义用[]或者new array(), 不用()
用find不用attr
请无视bind,我搞混了
完整代码:
I**A
发帖数: 2345
15
Thanks a lot
It turns out that there is a little problem with the xml files that I
downloaded. It works fine with the local xml testing file
Have another question, is a float number, how could I get that out? For
instance, .find('x').text() will give a string. Do you happen to know what
function will give a float number?'
Where can I find the document for the options like .find? the list that can
come after .find() , text, .css, etc?
http://api.jquery.com/find/

【在 s****y 的大作中提到】
: 数组定义用[]或者new array(), 不用()
: 用find不用attr
: 请无视bind,我搞混了
: 完整代码:

I**A
发帖数: 2345
16

For
never mind about this float number, I used parseFloat to convert it.
can
I still have this question though.
Thanks

【在 I**A 的大作中提到】
: Thanks a lot
: It turns out that there is a little problem with the xml files that I
: downloaded. It works fine with the local xml testing file
: Have another question, is a float number, how could I get that out? For
: instance, .find('x').text() will give a string. Do you happen to know what
: function will give a float number?'
: Where can I find the document for the options like .find? the list that can
: come after .find() , text, .css, etc?
: http://api.jquery.com/find/

s****y
发帖数: 983
17
method availability depends on the return type, e.g., find return a jQuery
type ,so most jquery methods are available
string->floating, you should find the answer urself by googling

【在 I**A 的大作中提到】
:
: For
: never mind about this float number, I used parseFloat to convert it.
: can
: I still have this question though.
: Thanks

I**A
发帖数: 2345
18
多谢多谢,我还得继续骚扰大家
JQuery这个cross-domain问题,据我理解,要设置一个类似proxy的玩意儿。比如说,
可以用YQL,这样的话,相当于数据都要送到yahoo给处理一下再传回给我当地,是这意
思么?
有没有别的解决方案?

jQuery

【在 s****y 的大作中提到】
: method availability depends on the return type, e.g., find return a jQuery
: type ,so most jquery methods are available
: string->floating, you should find the answer urself by googling

1 (共1页)
进入BuildingWeb版参与讨论
相关主题
想和一些搞网站的朋友交流一下Anybody need help on php/javascript projects?
How to change a port binding number?请教现代网页开发技术都是用css, js吗?
搜索效率问题请教问个jquery的简单问题
JQuery Plugin - appendDomjava网站写好,如何提速?
在此请教一个关于form里面change action地址的问题有什么好的JavaScript或者jQuery的画图的库吗?
急问,httprequest errorjquery是不是完全取代了javascript
现在网站都要学什么?css,ajax,...?大家现在用什么detect mobile device?
What javascript lib is better?关于JQuery的前途问题
相关话题的讨论汇总
话题: javascript话题: xml话题: row话题: find话题: 8722