You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

Unable to access Posted information in Custom Controller

Received Response
7
Views
2
Comments
edited May 8, 2018 5:24PM in Customer Portal 2 comments

Content

Hey All,

I'm playing around with the Javascript Fetch API but I am unable to send data. I preform the post with a simple bit of data to send and echo the data on the controller side. When i exec the fetch function it shows that the $_POST array is empty.

Am I doing something wrong? Does RNT do something special that is tripping me up here?

Thanks,
Simon

Version

3.7

Code Snippet

             JS
function genProductList4(){
	fetch("/cc/AjaxReportCaller/productSelector", {
		method: 'POST',
		data:{language: 'ru'},
		credentials: 'same-origin'
  	})
	.then((res) => res.text())
	.then((data) => console.log(data));
}


PHP

function productSelector(){
   echo "Where are the posts? \n";
   var_dump( $_POST );
}

RESPONSE
genProductList4()
undefined
Where are the posts? 
array(0) {
} 
        

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!