Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Ajax POST calls on page loads #113

Open
bhavinrshah opened this issue May 16, 2019 · 10 comments
Open

Issue with Ajax POST calls on page loads #113

bhavinrshah opened this issue May 16, 2019 · 10 comments
Assignees
Labels
Milestone

Comments

@bhavinrshah
Copy link

JS Request:
<script>
$(document).ready(function(){
// ajax call
var postUrl = 'getData.php';
var items = [];
var item = {
strReleaseName : 'test'
};
items.push(item);
var sortorder = {
items : items
};
$.ajax({
type : 'POST',
url : postUrl,
data : "format=json&data="+ JSON.stringify(sortorder),
dataType: "json",
success : function(data, textStatus, XMLHttpRequest){
alert('HI');
},
error: function (xhr, textStatus, errorThrown){
alert('Error');
}
});
});
</script>

Request Header:

CSRF Error

Please check.

@bhavinrshah
Copy link
Author

@mebjas : Can you please look into this?

@mebjas mebjas self-assigned this May 22, 2019
@mebjas
Copy link
Owner

mebjas commented May 22, 2019

@bhavinrshah on it

@mebjas
Copy link
Owner

mebjas commented May 22, 2019

So it looks to be related to this - #112

As a temp hack you could try making changes as suggested in this PR.

@bhavinrshah
Copy link
Author

I tried but that is not working.
I have to replace $(document).ready(function() { to $(window).bind('load', function() { and it works. But still if it can be done through csrfprotector.js that would be great.

@mebjas
Copy link
Owner

mebjas commented May 23, 2019

Yes please make the required changes as dont in that PR in CSRF Protector code. Can you have the projec ton github? I'll send a PR to the same to test this scenario further.

@bhavinrshah

@bhavinrshah
Copy link
Author

@mebjas : Let me create a test project on github and let you know

@bhavinrshah
Copy link
Author

@mebjas : Here is link https://github.com/bhavinrshah/csrf_issue

@mebjas
Copy link
Owner

mebjas commented May 29, 2019

@bhavinrshah will setup the stack and check. Stay tuned.

@bhavinrshah
Copy link
Author

@mebjas: Do we have any update on this?

@mebjas
Copy link
Owner

mebjas commented Jul 21, 2019

There is a missing submit.php file to completely reproduce this demo. Can you add some mock submit.php so I can test end to end?
@bhavinrshah

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Version 1.1.0
  
To do
Development

No branches or pull requests

2 participants