AJAX not passing data to CodeIgniter Controller

前端 未结 5 915
长情又很酷
长情又很酷 2021-01-16 18:27

Greeting StackOverflow! I am trying to pass data to controller using AJAX, but for some reasons it doesn\'t.

Controller:

public function updateSocial         


        
5条回答
  •  花落未央
    2021-01-16 18:52

    Try this..

    You can send data to server by data option in ajax and the type which defines. The default type is GET method

    Use " data: {name:name,address:address},"

     $.ajax({
                        type: "GET",
                        url: "controller/updatesocial", 
                        data: {name:name,address:address},
                        dataType: "text",  
                        cache:false,
                        success: 
                            function(data){
                                alert(data);  //as a debugging message.
                            }
    
                    });
    

提交回复
热议问题