Solved

Jquery xml

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

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

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

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…
This article discusses how to implement server side field validation and display customized error messages to the client.
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…

696 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