콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1211 화면

Hello, I'm including script inside my form view to call an API when the form is loaded. But, I need to pass a field value into that script. Can you help?

For example, I have the field "product_code" and need to pass its value into the following script:

var  Http  =  new  XMLHttpRequest ();
var  url  =  'https: // OURAPIURL /' ;

var  productdata  =  {
    "product_code""1223"
}

Http . open ( "POST"url );
Http . setRequestHeader ( "Content-Type" , "Application / JSON" );
Http . send ( JSON . stringify ( ProductData ));
Http . onreadystatechange = function () {
    if ( this . readyState == 4  &&  this . status == 200 ) {
        console . log ( Http . responseText )
    }
}


I'd like the value "1223" to be the value of the the "product_code" from the record.

아바타
취소