If (! Hide (& #039; display & #039;, & #039; & #039 if (! Empty ($ _ GET ['id']) {
$ Sale = M ("sale ");
$ Vo = $ sale-> getById ($ _ GET ['id']);
// Dump ($ vo );
If ($ vo ){
Echo json_encode ($ vo );
}
Front-end ajax writes like this
Function edit (id)
{
(('Your tan').css ('display ','');
$. Ajax ({
Type: 'post ',
Url :"ROOT/Livecrm/index. php? M = Cuactivity & a = edite & id = "+ id,
Success: function (data ){
Certificate ({name}.html ({name });
}
})
That is, how to assign data to corresponding elements after ajax is completed, such as a username name, sex, and ajax request to complete editing, the value is retrieved from the background. how can I use the html method to return the json to the response element.
Reply content:
If (! Empty ($ _ GET ['id']) {
$ Sale = M ("sale ");
$ Vo = $ sale-> getById ($ _ GET ['id']);
// Dump ($ vo );
If ($ vo ){
Echo json_encode ($ vo );
}
Front-end ajax writes like this
Function edit (id)
{
(('Your tan').css ('display ','');
$. Ajax ({
Type: 'post ',
Url :"ROOT/Livecrm/index. php? M = Cuactivity & a = edite & id = "+ id,
Success: function (data ){
Certificate ({name}.html ({name });
}
})
That is, how to assign data to corresponding elements after ajax is completed, such as a username name, sex, and ajax request to complete editing, the value is retrieved from the background. how can I use the html method to return the json to the response element.
$ ('# Name'). val ({name}) assigns a value to the input id for name. here are a lot of questions about jQuery: http://www.zoneself.org/category/jquery.
-
success:function(data){$(#name).html(data.name);$(#sex).html(data.sex);}
-
)