Hi all,
I’m currently working on a coding where my customer able to track their parcels on my webpage instead of track directly on my forwarders’ page.
Please assist which part I’m doing wrong.
Input - #trackingInput
button - #button1
text - #result
This is how it looks
Front code
import {getResult} from 'backend/serviceModule';
$w.onReady(function () {
});
export function #button1_click(event, $w) {
// This function was added from the Properties & Events panel. To learn more, visit http://wix.to/UcBnC-4
// Add your code for this event here:
getResult($w("#trackingInput").value)
.then(trackingInfo => $w("#result").text = trackingInfo + "°");
}
Backend Code
import {fetch} from 'wix-fetch';
export function getResult(tracking) {
const url = 'http://17express .net/Tools/expresscheck.ashx?name=' + tracking
console.log("url: " + url);
return fetch(url, {method: 'get'})
.then(response => response.json());
}
error message returned
invalid json response body at http://17express .net/Tools/expresscheck.ashx?name=KK202103011910290 reason: Unexpected token < in JSON at position 0