jQuery AJAX post not working, but works with curl
ajax, basecamp, curl, jquery, post
Solution
As karim79 said, you can't post to a different domain.
See Nathan's post for more options.
Problem
I'm trying to make a post request via ajax using jQuery (for the BaseCamp API), and I can't seem to get it to work. I can get it to work using curl just fine, so I know it's something I'm doing wrong with jQuery. Here's the curl command which works: ``` curl -H "Accept: application/xml" -H "Content-Type: application/xml" -u my.user.name:my.password -d "<time-entry><person-id>123456</person-id><date>08/23/2009</date><hours>8</hours><description>This is a test.</description></time-entry>" https://my.url.updatelog.com/todo_items/1234567/time_entries.xml ``` and here's the code I'm trying with jQuery: ``` var post_url = bc_base_url + "/todo_items/" + todo_id + "/time_entries.xml"; var xmlData = "<time-entry><person-id>" + bc_user_id + "</person-id>" + "<date>" + date + "</date>" + "<hours>" + time + "</hours>" + "<description>" + description + "</description>" + "</time-entry>"; $.ajax({ type: "POST", url: post_url, data: xmlData, dataType: "xml", contentType: "application/xml", username: "my.user.name", password: "my.password", processData: false, success: function(msg) { alert("successfully posted! msg: " + msg + ", responseText = " + this.responseText); }, error: function (xmlHttpRequest, textStatus, errorThrown) { alert("error : " + textStatus + ", errorThrown = " + errorThrown); alert("this.reponseText = " + this.responseText); } }) ``` Anyone have any ideas? Thanks!