I have just started working with react js and started facing some issue from some client side systems. while posting data to a php file from react js with (axios or ajax) session\_id() resetting and regenerating on every request/call. also session variable resetting. i have tried some solutions from stackoverflow but nothing worked.i have faced this issue from my localhost and some other systems. but working with some others systems too. it's like working with 50% system and not working with 50% system.

*But if i do this same thing without react js from normal html file with ajax to php file. session id is not resetting or regenerating.*

**PHP FILE**

```
<?php
session_start();
$session_val = session_id();
 header("Access-Control-Allow-Origin: *");

echo $session_val;

?>

```

**AJAX CALL FROM REACT JS**

```
$.ajax({
        url: "http://localhost/test.php",
        type: "POST",
        data: {
          action: action,
        },
        success: function (data) {
        },
        error: function (jqXHR, text, errorThrown) {
          console.log(jqXHR + " " + text + " " + errorThrown);
        },
      });

```

**AXIOS CALL**

```
    axios
    .post('http://localhost/test.php', this.state)
    .then(response =>{
        console.log(response.data);

    })
    .catch(
     error => {
        console.log(error)
    });

```