send message and username
hello. i need a solution for my web project. it seams simple but i can't get it working.
this is the deal:
user is register and loged in. he is viewing someones profile. so i have a php on witch i have a username (in form of php variable) of user browsing the site (user1) AND username of user who's profile is viewed (user2).
i need to have an option so that user browsing the site(users 1) can send a message to user2 without refreshing or redirecting page.
i can successfully send message text to php that will write it into database via js file, i also can send a user2 username to php that will write it into database via js file but only separately.
i need to send bouth message text (form) AND user2 username to php file that will write this to database. All WITHOUT refreshing page or redirecting (ajax).