hello can somebody help me to convert this code to Javascript and ajax. Or can somebody show me how to read the URL?
$productcode = ‘123434’;
$post_data = array(
‘productcode’ => json_encode($productcode)
‘token’ => ‘mytokencode21asda3qastq2a’,
);
$api_url=‘https://api.sales.com/v2/product/index’;
$curl = curl_init($api_url);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data);
$result = curl_exec($curl);
curl_close($curl);$string = json_encode($result);
$decodedArray = json_decode($result,true);