Question: hello i am creating chat widget which provide chat widget website. i have created it but i dont know in some website it is working but in some website it is not working at all. right now i am facing this issue Undefined index: data\_type in C:\wamp\www\college\chat\_service\_provider\receive\_msg.php on line 69pt?.
here is my code 

```
$.ajax({
        url: "http://127.0.0.1/college/chat_service_provider/receive_msg.php",
        method: "POST",
        data: {
            data_type: 'userdata', //i have tried 'data_type'
            email: a,
            key: c
        },
        success: function(a) {
            b = a;
            alert(a);
        }
    })

```

andthe php code 

```
echo $_POST["data_type"];

```

so in some website it is working properly and alert me userdata.
but in some website it returning me 
Undefined index: data\_type in C:\wamp\www\college\chat\_service\_provider\receive\_msg.php on line 69
so please help me to find this issue thank you.
now got the answer.
i have changed code.

```
$.post("http://127.0.0.1/college/chat_service_provider/receive_msg.php",
    {
        data_type: 'userdata',
        email: a,
        key: c
    },
   function(a) {
        b = a;
        alert(a);
    })

```

Answer: 
Try using post instead:

```
var data = {"email" : email, "key":key}
$.post("demo_test.asp", function(data, status){
    alert("Email: " + data.key + " Key: " + data.key + "\nStatus: " + status);
});

```
Please use firebug and open up the console, when you do the Post request did "userdata" get sent over in the Post request?

Please troubleshoot from there.