Results 1 to 4 of 4

Thread: Trouble with jQuery, Ajax, Jsp

  1. #1
    Join Date
    May 2008
    Posts
    551

    Trouble with jQuery, Ajax, Jsp

    I have a small problem: I'm hosting java servlets from JavaScript code below. The servlet works and returns the correct result but not displayed. This is the code in question:

    HTML Code:
    jQuery (document). ready (function () {
    refresh (document.getElementById ( 'elementPere1'). value, 'elementFils1', elementFilsSelected ',' nameServlet '); 
    });
    
    function refresh (dadId, sonName, selectedName, servletName) {
    jQuery.ajax ({
    type: "GET", url: "/ path /" + servletName + ". view", data: "dadId =" + dadId, datatype: "xml", 
    success: function (result) {
    var selectedValue = document.getElementById (selectedName +''). value 
    jQuery ( '#' + sonName). empty () 
    jQuery (result). find ( 'item'). each (function () {
    id_text var = jQuery (this). find ( 'value'). text (); 
    name_text var = jQuery (this). find ( 'name'). text (); 
    if (selectedValue == id_text) {
    jQuery ( 'selected=\"selected\" value=\'' <option id_text + +'\'>' name_text + + '</ option>'). appendTo ( '#' + sonName); 
    } else {
    jQuery ( 'id_text <option value=\'' + +'\'>' name_text + + '</ option>'). appendTo ( '#' + sonName); 
    } 
    }); 
    } 
    }); 
    }

  2. #2
    Join Date
    Feb 2008
    Posts
    1,852

    Re: Trouble with jQuery, Ajax, Jsp

    The success callback execute there? What version do you use jQuery? Have you watched (with Firebug for example) if an error occurs in JavaScript?

    it would seem that "elementFilsSelected" causes an error, it is wrong to copy and paste?

  3. #3
    Join Date
    May 2008
    Posts
    551

    Re: Trouble with jQuery, Ajax, Jsp

    Yes function of success in good time. I use jQuery 1.2.6

    Using Firebug and alert () everywhere, it seems that the problem appears from:
    Code:
    id_text var = jQuery (this). find ( 'value'). text ();
    When I do a alert (jQuery (this). Find ( 'value'). Text ()); it does not appear.

    For elementFilsSelected is indeed an error on my part.

  4. #4
    Join Date
    Feb 2008
    Posts
    1,852

    Re: Trouble with jQuery, Ajax, Jsp

    On this line here, making a console.dir (this) with Firebug to see what is returned, because I understand what you want to do, you want to display the value of attribute "value", if that is not made with the method find () with attr () (at least in the version 1.3 of jQuery in passing that I advise you).

Similar Threads

  1. Post Multiple Data with Ajax(Jquery)
    By Tyee in forum Software Development
    Replies: 4
    Last Post: 17-06-2011, 10:22 PM
  2. Read XML and RSS with jQuery
    By Ground 0 in forum Software Development
    Replies: 3
    Last Post: 27-11-2010, 06:18 AM
  3. jQuery AJAX vs. Adobe AIR AJAX Class
    By Agaev in forum Windows Software
    Replies: 5
    Last Post: 06-07-2010, 01:59 PM
  4. Is jQuery is best Js frameworks
    By Aashirya in forum Software Development
    Replies: 5
    Last Post: 11-02-2010, 01:38 AM
  5. Replies: 5
    Last Post: 13-01-2010, 09:29 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,717,928,277.80509 seconds with 17 queries