Trying to post a variable from js to php within a if clause


I am trying to post a variable within a if clause, but the php
document is not receiving the variable.
Here is some Code:



JS:



if(data.details.payment_type =="sofo")    {
var orderid = data.details.order_id;
$.post("LinkToPhpDocument.php", { orderidvalue: orderid });
window.location.replace("LinkToPhpDocument.php");
}


PHP



$orderID = $_POST['orderidvalue'];

- Technology - Languages
+ Webmasters
+ Development
+ Development Tools
+ Internet
+ Mobile Programming
+ Linux
+ Unix
+ Apple
+ Ubuntu
+ Mobile & Tablets
+ Databases
+ Android
+ Network & Servers
+ Operating Systems
+ Coding
+ Design Software
+ Web Development
+ Game Development
+ Access
+ Excel
+ Web Design
+ Web Hosting
+ Web Site Reviews
+ Domain Name
+ Information Security
+ Software
+ Computers
+ Electronics
+ Hardware
+ Windows
+ PHP
+ ASP/ASP.Net
+ C/C++/C#
+ VB/VB.Net
+ JAVA
+ Javascript
+ Programming
Privacy Policy - Copyrights Notice - Feedback - Report Violation 2018 © BigHow