Notifications
Clear all
BugOverflow
1
Posty
1
Users
0
Reactions
1,779
Widok
0
13/10/2016 12:45 am
Topic starter
custom api
1 Answer
0
13/10/2016 12:48 am
Topic starter
goto apache vhost or userdir config and add
1 2 3 4 5 6 7 |
Header always set Access-Control-Allow-Origin "*" Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT" Header always set Access-Control-Max-Age "1000" Header always set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, client-security-token" RewriteEngine On RewriteCond %{REQUEST_METHOD} OPTIONS RewriteRule ^(.*)$ $1 [R=200,L] |
Header always set Access-Control-Allow-Origin "*" Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT" Header always set Access-Control-Max-Age "1000" Header always set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, client-security-token" RewriteEngine On RewriteCond %{REQUEST_METHOD} OPTIONS RewriteRule ^(.*)$ $1 [R=200,L]
thenn u can use this jquery script
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
$("#wyslij").on("click",function () { var arr = { "key":"aasdfsdfads23453452345454359", "issue" :{ "project_id" : "10", "subject":"jest moc" } }; $.ajax({ url: 'http://my.server/issues.json', type: 'POST', data: JSON.stringify(arr), contentType: 'application/json; charset=utf-8', dataType: 'json', async: false, success: function(msg) { alert(msg); } }); return false; }); |
$("#wyslij").on("click",function () { var arr = { "key":"aasdfsdfads23453452345454359", "issue" :{ "project_id" : "10", "subject":"jest moc" } }; $.ajax({ url: 'http://my.server/issues.json', type: 'POST', data: JSON.stringify(arr), contentType: 'application/json; charset=utf-8', dataType: 'json', async: false, success: function(msg) { alert(msg); } }); return false; });
remember abut key, its on right side of http://my.redmine.server.localhost/my/account