0

This is driving me nuts ....

I have written a function

function seraliseQuery(){
for(var i=1; i<=variables;i++){
    alert(queryPreds[i]+" - "+queryObjs[i]);
  }
}

I just want to be able to call it from my other function

$(".object").click( function() {
    // code removed
seraliseQuery();
});

The error I get is "the function serialiseQuery() is undefined".

Everything is within

$(document).ready( function() { 
   // code goes here
}
Ankur
  • 50,282
  • 110
  • 242
  • 312

1 Answers1

5

You just spelled it wrong. Rename the function "serialiseQuery".

Phil Kulak
  • 6,960
  • 8
  • 45
  • 50
  • 1
    Yeah, but it's spelled the same wrong in both places, so it should still be called. – Robert Harvey Apr 20 '10 at 04:08
  • Yep it was misspelled in both places. But when I spelled it correctly the method got called .... no idea. Thanks for your help. – Ankur Apr 20 '10 at 04:13
  • 1
    Since when is a British spelling "wrong"? (not sure if the OP is actually British though :) http://www.merriam-webster.com/dictionary/serialise – Brian Moeskau Apr 20 '10 at 04:14
  • @bmoeskau You're missing the point - OP wrote "seralise". And btw, British spelling had always been wrong in US and vice versa ;) – Amarghosh Apr 20 '10 at 04:23
  • Javascript has become self-aware and does not accept invalid literal names anymore. It throws a LanguageException. – Anurag Apr 20 '10 at 04:36
  • I assumed that he copied the code into StackOverflow incorrectly: look at how the error message is spelled. – Phil Kulak Apr 20 '10 at 05:01
  • lol, yes I should have read more closely... "seralise" is not correct in any language :) – Brian Moeskau Apr 20 '10 at 05:44
  • 1
    Totally OT, but that reminds me of a home-grown framework I used to have to work with that was authored by a dev with terrible spelling. His API's method names contained lots of misspellings, so it was horribly painful to have to write calls into the framework by misspelling words in my own code. Made it really hard to code without code completion too. Ah, memories... – Brian Moeskau Apr 20 '10 at 05:48