У меня есть 5 функций javascript 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.
После того, как пользователь наберет сообщение в текстовом поле во всплывающем окне, затем после нажатия кнопки «Отправить» ajax вызовет messagePost.php для отправки сообщения в базу данных в виде следующего кода:
$(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;
});
});
Как видно из приведенных выше кодов, функция showMsg ();hidePopUpBox ();не может быть вызван, потому что функции не находятся на этой странице, мой вопрос: Как вызвать функцию javascript с другой страницы?