Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I've done a small .Js file to store all my small javascript functions inside.

And by now all of them worked fine.

Now I'm trying to put this function inside that file and it directly fails...
JavaScript
function onChangeComboBox(parametre, idDesti, php)
{
  xmlhttp = new XMLHttpRequest();
  xmlhttp.onreadystatechange = function()
  {
    if (this.readyState == 4 && this.status == 200) 
    {
      document.getElementById(idDesti).innerHTML = this.responseText;
    }
  };
  xmlhttp.open("POST",php+parametre,true);
  xmlhttp.send();
}


After the MadMyche suggestion, I've seen the error message is "temps.php:29 Uncaught ReferenceError: onChangeComboBox is not defined
at HTMLSelectElement.onchange (temps.php:29)"


viewed the page source code and opened the script file to see that the function is not there! even I can see it if I edit the file...

I'm sure I'm missing something stupid, but can't see it.

Thank you very much for your time and help!

What I have tried:

Different syntax in the path...
Posted
Updated 9-Sep-19 7:14am
v2
Comments
MadMyche 9-Sep-19 12:52pm    
Use your browsers debugger to see if it is being found (network tab) and look at the console to see if errors are being thrown
Joan M 9-Sep-19 12:58pm    
Didn't know that existed... :rolleyes: I'm getting this message "Uncaught ReferenceError: onChangeComboBox is not defined
at HTMLSelectElement.onchange" and it is normal that it says that... as the function is not there! even I can see it inside the code if I open the js file...
Joan M 9-Sep-19 13:17pm    
Thank you, I've learned a new thing today... and I've found the solution... had to press Ctrl+F5... :O:O:O:O
MadMyche 9-Sep-19 14:40pm    
It is an extremely helpful tool- from tweaking CSS to debugging JS and network issues. Can't forget the DOM inspector where you can delete blocks of page source

1 solution

Had to press Ctrl+F5 to ensure the page was refreshed...

I want to die.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900