在AJAX请求中从MySQL数据库中获取大数据

I am building a PHP application which makes use of Ajax as well.

The Ajax code i am using is

    function getdetails(id){
var xhr;
if(window.XMLHttpRequest){
xhr = new XMLHttpRequest();
}
else{
xhr = new ActiveXObject("Microsoft.XMLHTTP");
}

xhr.onreadystatechange = function(){
    if(xhr.readyState==4 && xhr.status==200){
        document.getElementById("updateform").innerHTML=xhr.responseText;
    }
}

xhr.open("GET","get_details?id="+id+"&table="+'<?php echo $table_name ?>',true);
xhr.send();
}

The PHP function that handles this is

public function get_details(){
        $id = $_GET['id'];
        $table = $_GET['table'];
        $query = $this->db->get_where($table,array('id'=>$id));
        if($query){
            $row = $query->row();
            echo form_open('members/update_detail');
            foreach ($row as $key => $value) {
                echo $key.'     <input type="text" name='.$key.' value='.$value.'><br>';
            }
            echo '</form>';
        }

        //echo $_GET['id'];
    }

I have defined a div with id "updateform". The code is working fine in the sense that it is fetching data. However, it is not fetching the entire data. For example : in a VARCHAR(200) field, if I store Stack Overflow , only Stack is getting displayed.

Is my method for fetching the data wrong?

First var_dump($row); and check it is as you expect.

Then instead of

 echo $key.'     <input type="text" name='.$key.' value='.$value.'><br>';

try

echo $key.'<input type="text" name="'.$key.'" value="'.$value.'"><br>';

As you're missing the quotes in the html output for name and value