我想與ajax編碼聊天框,但是當我撥打電話時,php文件shatbox.php不會出現。這裏是代碼和GitHubDiff。Ajax驗證發佈錯誤html
$(document).ready(function(){
\t $('#submit').on('click',function(){
\t \t var name = $('#name').val();
\t \t var shout = $('#shout').val();
\t \t var date = getDate();
\t \t var dataString = 'name=' + name + '&shout=' + shout + '&date' + date;
\t \t // validation
\t \t if(name == '' || shout == ''){
\t \t \t alert('please fill Your name and shout');
\t \t }else{
\t \t \t $.ajax({
\t \t \t \t type:"POST",
\t \t \t \t url:"../jschat/shoutbox.php",
\t \t \t \t data: dataString,
\t \t \t \t cache: false,
\t \t \t \t success: function(html){
\t \t \t \t $('#shout ul').prepend(html);
\t \t \t \t }
\t \t \t });
\t \t }
\t \t return false ;
\t });
});
function getDate(){
\t var date;
\t date = new date;
\t date = date.getUTCFullYear() +'-'+
\t \t ('00' + (date.getUTCMonth() +1)).slice(-2)+'-'+
\t \t ('00' + date.getUTCDate().slice(-2)+' '+
\t \t ('00' + date.getUTCHours().slice(-2)+ ':'+
\t \t ('00' + date.getUTCMinutes().slice(-2)+':'+
\t \t ('00' + date.getUTCSeconds().slice(-2);
\t return date;
}
開發控制檯中的任何錯誤? –