I have smth like this:

    echo CHtml::ajaxSubmitButton('Process','http://sm.widgetgen.com/api/send/s/859244cf9aaba64cbc50d1ffd1ee4620',
        array('dataType' => 'json',
              'type'=>'POST'),
        array('type' => 'submit'));

But it doesn't send the request.

2

There are 2 best solutions below

0
On

It depends. It will only work if the server sends Access-Control-Allow-Origin headers if it's a cross-domain request.

Apparently it doesn't seem to be the case in your scenario, so you will have to contact the administrator of the other server to work something out.

You also might want to try jsonp instead of json.

See jQuery AJAX cross domain for more info.

0
On

Thank you guys.

jsonp is a good thing when I can send POST requests or if I use https.

I decided to use CORS