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

I try to read a JSON obtained with CURL PHP from Ajax but it is null

Received Response
15
Views
11
Comments
edited Mar 19, 2018 7:04PM in Customer Portal 11 comments

Content

Using Curl php code (requesWebService.php) I consume a service and I have a Json response with the function json_decode (), when trying to bring this Json from my RN form with Ajax code the object is null and I need to access the JSON values. Will you have an example? Or something am I doing wrong in my code?
 

Version

Customer Portal 3.7.1

Code Snippet

             <script type="text/javascript"> 
document.querySelector('[name="Incident.Subject"]').addEventListener("change", function(){
  if(this.value == 'test'){
    $.ajax({
      url:"http://mercantilseguros--tst.custhelp.com/cp/customer/development/views/pages/requesWebService.php", 
			type: 'POST',
      contenttype: "Content-Type: application/json",
      datatype: 'jsonp',
			success: function(result){
        alert(result);
      }
  });   
            }
});
</script> 
        

Howdy, Stranger!

Log In

To view full details, sign in.

Register

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