• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

httpObject.onreadystatechange passing a variable to function - type mismatch error

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to create a generic AJAX function that has the data field passed to the function in order to return the results to the proper place.

Oddly enough, this does not work if I comment out the 'alert' line in the set_output, however it does work if I have it pop up those variables.

Either way, I do still get a type-mismatch on the line:


I figure that is because you shouldn't pass variables to a function in this way.



Any suggestions would be greatly appreciated!
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what would you expect from this script



now what do you expect
httpObject.onreadystatechange = setOutput(error_output, field_output); to do compared with var x = foo()?

You need to use a closure.

Eric
 
Chris Huber
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm new to closures, but I understand what that example script does. I'm not sure how to apply it to my script.
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Eric
 
Chris Huber
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, now I got it. Thanks - works great!
reply
    Bookmark Topic Watch Topic
  • New Topic