Solved

Jquery xml

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

What is a Lightbox? A Lightbox is the effect you see when you click, for example, an image and the screen fades out and up pops the same image but in its full size dimensions. There are lots of Lightbox effects for jQuery. Problem is they are a…
PROBLEM: The other day I was working on adding an ajax request to a webpage that already had a dialog box on the page.  The dialog box was using relative positioning to be positioned next to a form field I had on the page.  Everything was working…
The viewer will learn how to dynamically set the form action using jQuery.
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…

762 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now