mardi 14 juin 2016

.success UncaughtSyntaxError: Unexpected identifier


I am truly baffled as to why I am receiving the Unexpected identifier error with my code. The only thing that was changed recently was the URL. I am working on a project and while waiting for my project partner to setup Heroku, I diverted to this fake api. Here's my

$('#username-submit').click(function() {
  var userlinks = $('.user-links')
  console.log('test');
  $.ajax({
    method: 'GET', //this is a GET git request
    url: 'http://jsonplaceholder.typicode.com' //link to the API they created
    beforeSend: function(xhr) {
      xhr.setRequestHeader('Authorization', 'user name'); //takes the username and authorizes it
      dataType: 'json',
        .success(function(data) {
          console.log(data);
        })
    }
  })
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

Aucun commentaire:

Enregistrer un commentaire