Код: Выделить всё
var app = angular.module('enterprise', []);
app.controller('entercontroller', function($scope, $http){
$scope.loadData= function(){
$http.post('Groups_/load_data')
.then(function(mydata){
console.log(mydata);
$scope.datas = mydata.data;
});
};
$scope.loadData();
});
Код: Выделить всё
public function load_data(){
$data["groups"] = $this->Groups->fetch_groups();
return $this->output
->set_status_header(200)
->set_content_type('application/json', 'utf-8')
->set_output(json_encode($data["groups"], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES));
}
Код: Выделить всё
$(document).ready(function() {
$('#add').on('submit', function() {
var that = $(this);
$dataString = that.serialize();
$.ajax({
url: ''+ $("#uri").val() ,
type: 'POST',
dataType: 'json',
cache:false,
data : $dataString,
success: function (data) {
console.log(data);
$('#message').html(data['message']);
$(':input','#add')
.removeAttr('checked')
.removeAttr('selected')
.not(':button, :submit, :reset, :hidden, :radio, :checkbox')
.val('');
},
error: function (data) {
console.log('error');
console.log(data);
}
});
return false;
});
});
Код: Выделить всё
[i]
Group Name
Link
Icon
[/i] save
[i][/i] cancel
title
link
order
icon
control
{{ d.group_title }}
{{ d.group_link }}
{{ d.group_order }}
[i][/i]
[url=#] [i][/i] [/url]
[url=#] [i][/i] [/url]
Мне нужно снова загрузить то же место после добавления.
Есть идеи.
Подробнее здесь: https://stackoverflow.com/questions/467 ... g-the-page
Мобильная версия