WmZilla - Webmaster and Marketplace

The Next Generation Webmaster and Trade Forum

Non-working Ajax function

brbr

New member

0

0%

Status

Offline

Posts

41

Likes

0

Rep

0

Bits

215

3

Months of Service

0%
Hello, I've been dealing with this for a few days, it's really interesting. Despite the lack of any visible issue or a connection problem, my two script codes just aren't working together. I would be very happy if you could help, thank you in advance.

---

We are fetching messages.

```JavaScript
function fetchMessage(){
var senderId=;
var receiverId=$("#divContacts input[type='radio']:checked").val();
$.ajax({
type : "POST",
url : "fetchMessage.php",
data : {senderId:senderId, receiverId:receiverId},
});
}
```

Below is my PHP page that queries based on the two values it receives:

```PHP
include('connect.php');
if($_POST){
$senderId=$_POST['senderId'];
$receiverId=$_POST['receiverId'];
$query=mysqli_query($connection,"select chat.chatId, chat.senderId, chat.receiverId, chat.content, chat.date, users.fullName, users.title from chat inner join users on chat.senderId=users.userId where chat.receiverId='$receiverId' and chat.senderId='$senderId'" );
while($row=mysqli_fetch_array($query)) {
echo $row["fullName"];
echo ":";
echo $row["content"];
echo '';
}
}
```
---

Ensure to replace the placeholders like "divKisiler" with appropriate English keywords to enhance SEO compatibility.
 

249

6,622

6,642

Top