$ .ajax()调用不起作用

I'm trying to make this call to send data to the server:

$.ajax({
   type: "POST",
   url: "/videos"
   data: { title = oembed.title }
});

However, this doesn't seem to work. I make a call to the Embedly API like so:

$('a.oembed').embedly({maxWidth:300,'method':'replace'}).bind('embedly-oembed', function(e, oembed){ 
    });

so that I have access to the dynamically generated hash oembed, and I want to save oembed.title. I tried the $.ajax() call both outside and within the embedly call, and it seems to prevent the entire call to embedly from working. What am I doing wrong?

Use data: { title: oembed.title } not =

Use a colon instead of a equals, and don't forget the comma after url:

$.ajax({
 type: "POST",
 url: "/videos",
 data: { title: oembed.title }
});

You're missing a comma after:

url: "/videos"

The following line :

data: { title = oembed.title }

seems not OK ; it should be written this way, so the data is a valid JSON object :

data: { title : oembed.title }

Note : in JSON, the value of an object's property is separed of its name by a colon ; not an equal sign.
See json.org for a reference of the JSON syntax.


Also, you are missing a comma at the end of this line :

url: "/videos"

which should be written like this :

url: "/videos", 

Try changing you data json declaration to

{ "title": oembed.title }

Try

$.ajax({
   type: "POST",
   url: "/videos",
   data: { title: oembed.title }
});

Also I don't see any handling of the response. Perhaps you would like to add a success handler:

$.ajax({
       type: "POST",
       url: "/videos",
       data: { title: oembed.title },
       success: function(data, textStatus, jqXHR) {
         /* your code here - check http://api.jquery.com/jQuery.ajax/ */
       }
 });