I have 5 javascript functions index.php :
1) showMsg(); //this display 50 latest messages
2) showPopUpBox(); // this I use jquery to load the textbox and send button from typingMsg.php
3) hidePopUpBox(); // this hide pop up box
4) checkNewMsg(); // this will be auto reloaded every 5 sec to check if there is new message, it will show the numbers counts of total new messages.
5) ShowNewMsg(); // this function will be called when the user click the "show new messages" button.
After a user typing message on the text box on the pop up box then after he click "Send" button, ajax will call messagePost.php to submit the message to database, as the following code :
$(function() {
$(".button").click(function() {
$.ajax({
type: "POST",
url: "messagePost.php",
data: dataString,
success: function() {
$('textarea.expand25-75').val('');
showMsg(); //this is my problem
hidePopUpBox(); //this is my problem too
}
});
return false;
});
});
As u can see from the codes above, the function of showMsg(); hidePopUpBox(); cannot be called because the functions are not on this page, my question is How to call the javascript function from different page?
How to call the javascript function from different page?and what is a different page?<script type="text/javascript" src="pageLocation"></script>