☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Widget js callback - Ajax POST violates same-origin policy?!

Community Support
Pythonic
Pythonic

Hello

I have embedded a bokeh slider into a flask template, and would like to send a POST Ajax request within its callback.

However that seems to infringe the same-origin policy, even if it all is happening on localhost. (see here and here for details of the issue).

Any clue why is that, and if it could be solved? Thanks

Code snippet from the slider’s callback:

$.ajax({

type: 'POST',

contentType: 'application/json',

url: "http://127.0.0.1:5000/server_calculations",

data: slider_value, //this is simply the value of the slider's position

dataType: 'json',

});

⌁   Link to post
Pythonic
Pythonic

And as a side note, this is calling to the same page where the widget is embedded

···

On Tuesday, 9 June 2015 15:32:48 UTC+1, Pythonic wrote:

Hello

I have embedded a bokeh slider into a flask template, and would like to send a POST Ajax request within its callback.

However that seems to infringe the same-origin policy, even if it all is happening on localhost. (see here and here for details of the issue).

Any clue why is that, and if it could be solved? Thanks

Code snippet from the slider’s callback:

$.ajax({

type: 'POST',
contentType: 'application/json',
url: "[http://127.0.0.1:5000/server_calculations](http://127.0.0.1:5000/server_calculations)",
data: slider_value, //this is simply the value of the slider's position
dataType: 'json',

});

⌁   Link to post
Pythonic
Pythonic

And problem solved credit to this SO post:

solution is to remove the URL from the post request

$.ajax({

type: 'POST',

contentType: 'application/json',

// comment this out: url: "[http://127.0.0.1:5000/server_calculations](http://127.0.0.1:5000/server_calculations)",

data: slider_value, //this is simply the value of the slider's position

dataType: 'json',

});

···

On Tuesday, 9 June 2015 16:55:58 UTC+1, Pythonic wrote:

And as a side note, this is calling to the same page where the widget is embedded

On Tuesday, 9 June 2015 15:32:48 UTC+1, Pythonic wrote:

Hello

I have embedded a bokeh slider into a flask template, and would like to send a POST Ajax request within its callback.

However that seems to infringe the same-origin policy, even if it all is happening on localhost. (see here and here for details of the issue).

Any clue why is that, and if it could be solved? Thanks

Code snippet from the slider’s callback:

$.ajax({

type: 'POST',
contentType: 'application/json',
url: "[http://127.0.0.1:5000/server_calculations](http://127.0.0.1:5000/server_calculations)",
data: slider_value, //this is simply the value of the slider's position
dataType: 'json',

});

⌁   Link to post

End of archived discussion · Replies are disabled