JS Ajax calling PHP and getting ajax call data

前端 未结 3 1805
死守一世寂寞
死守一世寂寞 2021-01-24 22:19

I have a standard javascript ajax call where I\'m setting the data: to json data.

$.ajax({
    type: \"POST\",
    url: BaseUrl + \"User/Login\",    
    //url:          


        
3条回答
  •  青春惊慌失措
    2021-01-24 23:12

    First, the data sent must be a JSON object and not a string. Remove the quotes.

    Also, in your server-side, you'll better decode the input $_POST['data'] with json_decode() (see documentaion)

提交回复
热议问题