S
S
shnicel2015-01-02 22:14:38
JavaScript
shnicel, 2015-01-02 22:14:38

How to substitute value in ajax request?

pliz tell me how to substitute a value from a variable in ajax and in general in js?

<script type="text/javascript">

var id = "2693258***"

$.ajax({
    url : "https://api.vk.com/method/users.get?user_ids=+ id +",
    type : "GET",
    dataType : "jsonp",
    success : function(profile){
    console.log(profile.response[0]);
    $('#profile').append(profile.response[0].uid);
    }
});
</script>

How to substitute the value of var id here url : " https://api.vk.com/method/users.get?user_ids=+ id +" ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton, 2015-01-02
@shnicel

Before you write something like this, at least study what you are writing it on.
There is a lot of information on your topic here:
https://learn.javascript.ru/function-basics

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question