Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 24-04-2009
Member
 
Join Date: May 2008
Posts: 548
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); 
} 
}); 
} 
}); 
}
Reply With Quote
  #2  
Old 24-04-2009
Member
 
Join Date: Feb 2008
Posts: 1,848
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?
Reply With Quote
  #3  
Old 24-04-2009
Member
 
Join Date: May 2008
Posts: 548
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.
Reply With Quote
  #4  
Old 24-04-2009
Member
 
Join Date: Feb 2008
Posts: 1,848
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).
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Trouble with jQuery, Ajax, Jsp"
Thread Thread Starter Forum Replies Last Post
Post Multiple Data with Ajax(Jquery) Tyee Software Development 4 17-06-2011 10:22 PM
Read XML and RSS with jQuery Ground 0 Software Development 3 27-11-2010 06:18 AM
jQuery AJAX vs. Adobe AIR AJAX Class Agaev Windows Software 5 06-07-2010 01:59 PM
Is jQuery is best Js frameworks Aashirya Software Development 5 11-02-2010 01:38 AM
Give information regarding jQuery CSS, AJAX and Call back Functions Jorgea Software Development 5 13-01-2010 09:29 PM


All times are GMT +5.5. The time now is 12:24 PM.