-6

I've encountered code below and I'm not fully sure what it's achieving.

I think it invokes the service 'getvalues' and passes some data into the service. On success the data returned is processed. Is this correct ?

 $.ajax({
      url: 'getvalues',
      data: ({urlVal : value}),
      success: function(data) {           
      }
    });
10
  • 3
    Read this api.jquery.com/jQuery.ajax Commented Mar 30, 2012 at 19:37
  • 1
    is this a lecture or an inquiry? i see no question. Commented Mar 30, 2012 at 19:38
  • 1
    jQuery has a pretty good API. api.jquery.com/jQuery.ajax Commented Mar 30, 2012 at 19:38
  • 1
    Because it is a valid question that could be answered with just a little research Commented Mar 30, 2012 at 19:45
  • 1
    "Why all the downvotes" Because the docs explain it as linked by multiple people and people probably think you did not put the effort into researching before asking. Commented Mar 30, 2012 at 19:46

3 Answers 3

2

Did you try asking google?

http://api.jquery.com/jQuery.ajax/

url:

A string containing the URL to which the request is sent.

data:

Data to be sent to the server. It is converted to a query string, if not already a string.

success(data, textStatus, jqXHR):

A function to be called if the request succeeds.

1

calls the getvalues url and passes the parameters urlVal to that page, then it gets the returns data from getvalues, but does not output it.

1

Exactly.

It makes a GET request to 'getvalues' url (relative to current page),
sending value of value variable as urlVal parameter,
and on success it does nothing (empty function).

1
  • $.ajax makes a GET request by default, not POST. Commented Mar 30, 2012 at 19:42

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.