Ajax / PHP code causes 404 error -


i'm running javascript function know being ran , working, seems ajax part isn't working.

javascript:

socket.on('chat-message', function(msg){    $('#messages').append($('<li>').text(msg));    $.post("test.php", {message: msg}); });  

test.php:

<?php     $message = $_post['message'];     mkdir($message); ?> 

does know i'm doing wrong?

edit: seem getting 404 error on php file doesn't make sense since file in same directory index.html file

d:\xampp\htdocs\collabs\examples\chat

picture

your php , nodejs code 2 separate web servers, running on different ports. php script running on apache on port 80 , node.js on port 3000.

change ajax post request port 80:

$.post("http://localhost/test.php", {message: msg}); 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -