Solved

Jquery xml

Posted on 2013-01-15
3
236 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
  • 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
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…

803 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