fetch("address/API/V1/api code/SMS/$w("#input8").value/AUTOGEN", {"method": "get"}) i am unable to add 3rd party api for otp

I can only see your post subject but I see no contents in the post body.

fetch(“address/API/V1/api code/SMS/$w(”#input8").value/AUTOGEN", {“method”: “get”})
.then( (httpResponse) => {
let url = httpResponse.url;
let statusCode = httpResponse.status;
let statusText = httpResponse.statusText;
let headers = httpResponse.headers;
let bodyUsed = httpResponse.bodyUsed;
if (httpResponse.ok) {
return httpResponse.json();
}
else {
return Promise.reject( “Fetch did not succeed” );
}
} )
.then( (json) => {
let z =console.log(json.someKey).value;
console.log(json.someKey);
} )
. catch ( (err) => {
console.log(err);
}
fetch( " address/API/V1/api code /VERIFY/{session_id}/ $w(“#input7”).value " , { “method” : “get” })

);

half part of the code is working but half is not working, how to pass the session id in the last line and according to the result, how to print success or failure on screen,
And how to assign a value to a variable such that it will be available on all pages!! sorry i am new, so i didn’t find difference in body and subject! plz help!

The url is wrong as it uses the variable name string instead of the variable itself.

@jonatandor35 Thank You so much, its working now! Can you plz help me with the result, i am using multiple registration form, when otp entered by user is invalid i want to display error message and stop form submission, and when it is correct then allow form submission, Right now i am able generate otp and verify too, but i am unable to stop form submission on incorrect otp,

@rahuljharm if you submit using code, please post the code.