作者:sl51866 | 来源:互联网 | 2023-10-11 10:01
function stationMenu($scope){
$.ajax({
url: "/users/station_names_ajax",
type: "POST",
success: function(data){
$scope.phOnes= [
{"name": "Nexus S",
"snippet": "Fast just got faster with Nexus S."},
{"name": "Motorola XOOM™ with Wi-Fi",
"snippet": "The Next, Next Generation tablet."},
{"name": "MOTOROLA XOOM™",
"snippet": "The Next, Next Generation tablet."}
];
//console.log(Stations);
}
});
// $scope.phOnes= Stations;
// console.log(Stations);
}
where as if I do this
好像我这样做
function stationMenu($scope){
$scope.phOnes= [
{"name": "Nexus S",
"snippet": "Fast just got faster with Nexus S."},
{"name": "Motorola XOOM™ with Wi-Fi",
"snippet": "The Next, Next Generation tablet."},
{"name": "MOTOROLA XOOM™",
"snippet": "The Next, Next Generation tablet."}
];
}
it works....how can I make it work within ajax
它工作....我怎样才能使它在ajax中工作
2 个解决方案