Javascript Object Creation| Making Reusable Javascript Objects

Publié le: 28 April 2020
sur la chaîne: kuntal chakrabarti
59
3

In this video, I have explained how to create reusable Javascript Objects.

Source code used in this video is pasted below

(lt) is here meant start tag character which is not allowed to be pasted in youtube
(gt) is here meant end tag character which is not allowed to be pasted in youtube

(lt)!--javascript Objects --(gt)

(lt)!-- Object Extension in Javascript --(gt)
(lt)html(gt)

(lt)head(gt)(lt)title(gt)This is a Javascript Object Exercise(lt)/title(gt)
(lt)script src="./lib.js"(gt)(lt)/script(gt)
(lt)script(gt)

/*function AJAX_CALL_OBJ()
{
this.ajaxObject="This is my AjaxObject: AJX001"; // Create proper ajax object
this.load=function(url){
alert('I am going to call the ajax Object: '+url);
//Put code to call ajax and get the response
alert('I am getting response');
}
}*/

function doCall()
{
var ajaxObject=new AJAX_CALL_OBJ();
var url="http://path:7001/ServletTarget";
ajaxObject.load(url);

}
(lt)/script(gt)

(lt)/head(gt)

(lt)body(gt)

(lt)form name='actionForm'(gt)

(lt)input type='button' name="submit" value="AjaxSubmit" onClick='doCall();'(gt)
(lt)/form(gt)

(lt)/body(gt)
(lt)/html(gt)

***********************************
/*Contents of lib.js */
function AJAX_CALL_OBJ()
{
this.ajaxObject="This is my AjaxObject: AJX001"; // Create proper ajax object
this.load=function(url){
alert('I am going to call the ajax Object from a separate JS File: '+url);
//Put code to call ajax and get the response
alert('I am getting response');
};
}


Sur cette page du site, vous pouvez voir la vidéo en ligne Javascript Object Creation| Making Reusable Javascript Objects durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur kuntal chakrabarti 28 April 2020, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 59 fois et il a aimé 3 téléspectateurs. Bon visionnage!