English 中文(简体)
为什么 j笑给我这个法典的“ele子”错误?
原标题:Why does jquery give me a "selector is undefined" error for this code?

我确实在努力解决一个问题,我希望这里的某个人需要一些时间帮助我。 I m试图在使用j Query 1.6.2和JQM 1.0rc3的xml文件中找到一个名为“Emotion”的儿童的最后文本选择。 XML文件Im有以下结构。

<StatusModel>
 <Uid>5e4dc88f-f703-4e34-92f6-609216de6c6f</Uid>
 <Created>Wednesday, November 02, 2011 2:20 PM</Created>
 <User>larry_irons</User>
 <Level>2</Level>
 <Doing>typing</Doing>
 <Thinking>the pain in my neck</Thinking>
 <Emotion>Pain</Emotion>
</StatusModel>

The following ajax Coderecoverys the full xml document and I see the succesful in Getbug s console. 然而,我还收到“机器人不是未界定的”错误信息,而这一功能未能检索作为“跟踪”声明试图做到的改动案文。 The ajax is as follows:

$( #feeling ).live( pageinit , function (event) {


    $.ajax({
        type: "Get",
        url: "/api/list",
        cache: false,
        dataType:  xml ,
        success: function (xml) {

            manipulateType(xml);
        }


    });

    function manipulateType(xml) {

        //empty the emotion_type div
        $("#emotion_type").html("");

        //retrieve current emotion to track and append to div emotion_type
        $(xml).find( StatusModel ).each(function () {

            var tracking = $(this).find("Emotion").text();


            //append content and tracking variable to div emotion_type
            $( #emotion_type ).append("On a scale of 1 (low) to 10 (high) I m feeling this much&nbsp;" + tracking +  : );

            //refresh the review data div #summarylist
            $( #emotion_type ).live("refresh");

        });
    }
});

我假定错误信息是“跟踪”声明的结果。 然而,我申请的另一页几乎是相同的法典,没有错误的信息。 如果有人愿意与我接触,我需要两点意见。

Can you see any obvious problem with how I m declaring the selector?

您能否对我如何修改《公约》发表一些看法,以便把最后一位儿童节点的“教育”文本列入xml文件?

<>Update: 我改为“jquery.mobile-1.0.js和jquery-1.6.4.js”,错误仍然存在。

问题回答

你们是否把数据当作一种扼杀手段? 在此情况下,你需要通过浏览器窗户来做到这一点。 DOMParser (firefox, chrome) oractiveXObject (IE). 我怀疑是实际的遴选人,看着罚款。

Also, it is good to save your reference to $("#emotion_type") before you iterate (and choose a better name :).

function manipulateType(xml) {
    var emo = $("#emotion_type");

    //empty the emotion_type div
    $(emo).html("");

    //retrieve current emotion to track and append to div emotion_type
    $(xml).find( StatusModel ).each(function () {

        var tracking = $(this).find("Emotion").text();


        //append content and tracking variable to div emotion_type
        $(emo).append("On a scale of 1 (low)...");

        //refresh the review data div #summarylist
        $(emo).live("refresh");

    });
}




相关问题
ajax login using httpRequest?

I am trying to develop my login script to give feedback to the user if the login is valid or not. Basically if it isn t correct a div box will show saying its wrong, if its correct it will show its ...

Virtual Tour using sketch up, ajax, flash technologies

I want to know if there are existing technology that make your 3d models in sketch into virtual tours, using either Ajax or Flash for web presentation. If there s none, which will be a good approach ...

How can i update div continuously

I have asp.net application where i have a div which showing the value from other site. The value of that site is changing continuously. I want that my div will automatically update in some interval ...

热门标签