S
S
shnicel2015-01-03 17:16:54
JavaScript
shnicel, 2015-01-03 17:16:54

What am I doing wrong, the value in the first name is not displayed?

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <script type="text/javascript" src="./js/jquery-2.1.4.js"></script>
  <script type="text/javascript" src="./angular/angular.js"></script>
  <script type="text/javascript" src="./bootstrap/js/bootstrap.js"></script>
  <!--  <script src="//vk.com/js/api/xd_connection.js?2" type="text/javascript"></script>  -->

  <link rel="stylesheet" type="text/css" href="./bootstrap/css/bootstrap.css">

<script>
var myApp = angular.module('myApp',[]);

myApp.controller('profileCtrl', ['$scope', function($scope){
      var req="https://api.vk.com/method/users.get?user_ids=1"
      $.ajax({
          url : req,
          type : "GET",
          dataType : "jsonp",
          success : function(msg){
          console.log(msg.response[0].first_name);	
          $scope.resp = msg.response[0].first_name;
          }
      });
    }]);
</script>
</head>
<body>
  <div class="container" ng-app="myApp">
    <div class="profile" ng-controller="profileCtrl">
      <div id="First_name">{{ resp }}</div>
      <div id="Last_name"></div>
      <div id="City"></div>
      <div id="Avatar"></div>
    </div>
  </div>
</body>
</html>

There is an answer in the console, but the diva is empty, what the hell?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stopy, 2015-01-03
@Stopy

scope.$apply()
Don't use angular and jq together

A
Andrei, 2015-01-03
@R0dger

write your service and you will be happy... and the previous speaker is right!!!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question