Send Post Ajax outside the same project

Asked

Viewed 41 times

0

Explaining better, in Eclipse PHP I have Project 1 and Project 2, and I am emulating PHP in Xampp, I wanted to send a Post via Ajax from Project 1 to Project 2, but I’m not getting it.

Error:

XMLHttpRequest cannot load http://localhost/appread/Post.php. 
Response for preflight is invalid (redirect)

Ajax code:

 $('#btn-sinc').click(function(){

    $.ajax({
          type: "POST",
          url: 'http://localhost/appread/Post.php',
          data: "cliente="+ClienteStorage,
          contentType: "application/json; charset=utf-8",
          dataType: 'json',
          success: function (data){
              alert('Dado Enviado');
          }

    });

});

I’m pretty sure the code isn’t quite right. If anyone can lend a hand I’d appreciate it.

  • 1

    give a read: https://d-mueller.de/blog/cross-domain-ajax-guide/

  • Thank you @Virgilionovic

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.