Re: little Ajax problem

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi,

Patrick.O.Ige wrote:
I have this Ajax script below that returns data ...

I am not sure that you totally understand what you're doing. First, it was really not necessary to post the whole script here. Then, the formatting is really messed up. Finally, executing the script in any debugger (Venkman, Visual Studio, Windows Script Debugger...) would have shown you quite fast what the problem is.

The function showCustomer needs a string as input. When you use the "str" parameter, you do:

url=url+"?employeeID="+str;

However, you call the method with:

showCustomer(document.getElementById('time'));

document.getElementById returns a DOM Node object. When you attempt to use the object as a string, the "toString()" method (which each object inherits from the "Object" class) is called. Since it has not been overriden in the Node class, it simply returns [Object].

Call the method using
showCustomer(document.getElementById('time').value);

The value property is (in this case, and only because "time" is a textfield) a string containing the content of the textfield.

<snip>

HTH,
Laurent
--
Laurent Bugnion [MVP ASP.NET]
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
.



Relevant Pages

  • Re: Sencha Touch--Support 2 browsers in just 228K!
    ... this particular script is so awful that anyone who could ... These functions are available on every String object. ... if (!dom) { ... @param o The object with the attributes ...
    (comp.lang.javascript)
  • Re: How to rewrite with awk?
    ... > I'm unfamiliar with tools such as sed & awk. ... Extract the string that matches a RE. ... This script will not only expand all the lines that say "include ... file) and not resetting ARGV(the tmp file), it then lets awk do any ...
    (comp.unix.shell)
  • Re: Slow string
    ... I see virtually no difference in execution time for the code you posted when using cscript versus using wscript; to confirm, I bracketed the code with an initial ... Are you actually entering the script name into a console window? ... You can use the exact same line for every wrapper script - and that includes wsf and js scripts; all you need to do is change the final "vbs" to "wsf" or "js" as appropriate. ... If you build a large string by small concatenations, the performance degrades geometrically - so does array resizing, because they both use the same nasty technique inherited from VB1 of copying the entire data structure to a new structure with the added element. ...
    (microsoft.public.scripting.vbscript)
  • Re: Function that returns date of file.
    ... string after the date/time when it is used by itself. ... Is that your entire script? ... I make an IF statement that required the 'equals equals'. ... designed database your job will be all that much harder. ...
    (alt.php)
  • Re: Script: Remote shutdown of all domain computers
    ... When trying to run the script from a XP workstation, where i am logged in as ... Dim strBase, strFilter, strAttributes, strQuery, objRecordSet ... 2000 or above and allow shutdown, ... Public Function AllComputersAs String() ...
    (microsoft.public.windows.server.scripting)