Refused to set unsafe header “Cookie” with ajax call Rest server

前端 未结 1 1649
面向向阳花
面向向阳花 2021-01-03 01:57

Im busy building a Phonegap app that connects with my Drupal rest server (Module: Services). My Drupal website (PHP) has the code: header(\'Access-Control-Allow-Origin: *\')

相关标签:
1条回答
  • 2021-01-03 02:22

    You are trying to set cookies for separate ajax call but this is not allowed by XMLHttpRequest specification. Instead, you can set a cookie to the current page and browser will put it in your ajax request if domain/path matches, i.e. by using jquery.cookie plugin:

    $.cookie('the_cookie', 'the_value', { path: '/' });
    
    0 讨论(0)
提交回复
热议问题