开发者

POST with curl gives correct output but with AJAX gives an error

开发者 https://www.devze.com 2023-04-03 20:42 出处:网络
I am quite frustrated with a very weird issue. I am trying to do a very simple thing here. I would like to post a form to an endpoint. I tried using the following command:

I am quite frustrated with a very weird issue. I am trying to do a very simple thing here. I would like to post a form to an endpoint. I tried using the following command:

 curl -d "Contact=Aditya&address1=1510 E. 9th Street&address2=Apt. 111&city=Tucson&state=AZ&zip=85719&Phone1=5207849817&Phone2=1237849812&email=aditya15417@yahoo.com&key2=09 New Lead&key5=AmpushU&uhsgradyr=1950&uhighlevel=AA&ucourseint=BA Internet Mktg&uCampaignID=Herlambang&utextperm=YES&uleaddate=20110910&uleadtime=19:18 PST" http://dev.degreeamerica.com/candidate_test.php

And yes it succeeds just fine, however when I try it via the site it gives me an error. Can someone tell me what I did wrong? The parameter I have on the curl is just something I copy and开发者_StackOverflow社区 paste from firebug POST request, so the parameter is all the same. Is there something wrong with me doing the AJAX?


You can't receive the results of a cross-domain post like that. Your page is on adityaherlambang.com, but you're posting to degreeamerica.com, so you can't get the results

One solution is to use a server-side proxy on adityaherlambang.com, and post using libcurl to degreeamerica.com, while returning whatever kind of status you want to your own site's JavaScript.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号