Solved

Jquery xml

Posted on 2013-01-15
3
238 Views
Last Modified: 2013-01-22
The following code ceased to work today.

$(data).find("ListItem").each(function()
                              {
                                    h += "<option value='" +  $(this).attr("Code")  +   "'>"  +  $(this).attr("Code") +  " " + $(this).attr("Desc") + "</option>"
                                    
                              });

It errs on the $(this).attr("Code")
where ListItem is an xml node with Code and Desc verified as attributes in every node.

I am using the http://code.jquery.com/jquery-latest.min.js
so I am asking if this should be suspect, something deprecated?
0
Comment
Question by:KeithMcElroy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 

Author Comment

by:KeithMcElroy
ID: 38781094
Here is a broader sample of the code

      $(document).ready(function(){
                   $.ajax({
                        type: "POST",
                        url: "../../isapi/btwebrqb.dll",
                        data: xmlContent,
                        contentType: "text/xml",
                        dataType: "xml",
                        success: function(data,extStatus,jqXHR){
                              var h = "<option value=''></option>"
                              $(data).find("ListItem").each(function()
                              {
                                    h += "<option value='" +  $(this).attr("Code")  +   "'>"  +  $(this).attr("Code") +  " " + $(this).attr("Desc") + "</option>"
                                    
                              });

                              $("#vacancyi_departmt_1").html(h);  //make blank per spec
                              $("#position_newrdept_1").html(h);
                        },
                        complete: function(){
                        
                              sortListByText("#vacancyi_departmt_1");   //GOTO:  load-picklists.js:16
                              sortListByText("#position_newrdept_1");   //GOTO:  load-picklists.js:16

                                    
                        },
                        error: function(request,status,error){
                              alert("Error occurred Ref: load-picklists.js loadDeptList Line 175 Error:" + request.responseText);                                                      }
                  });
            });
0
 

Author Comment

by:KeithMcElroy
ID: 38781202
More info,  I swtiched bewteen the following

<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script src="http://code.jquery.com/jquery-1.8.3.js" type="text/javascript"></script>

First line fails, second line succeeeds.
So, why?  is the xml attr deprecated?
This broke today, was working on Saturday.
0
 
LVL 27

Accepted Solution

by:
Lukasz Chmielewski earned 500 total points
ID: 38781853
I believe it is working,
http://jsfiddle.net/3a6rG/6/
unless the XML is malformed (?)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Requirements JQuery 1.6+ HTML CSS Introduction This article was inspired by an EE question (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28372511.html) on how to make a page show some balloons animate up a page…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question