You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by ss...@yahoo.com.INVALID on 2014/09/16 02:41:40 UTC
JavaScript and RequireJS
I have the following script in my .tml page
$.support.cors = true;
$("#refBtn").click(function(){
var myurl = buildURL("${getLegacyUser()}", "${getLegacyCompany()}", "${getLegacyTranId()}")
alert(myurl);
$.ajax({
url : myurl,
type : "GET",
success: function(responseData, textStatus, jqXHR) {
alert("Data: " + responseData);
},
error: function (jqXHR, textStatus, errorThrown)
{
alert("this is the error being thrown: " + errorThrown + " Status :"+ textStatus);
console.log("error: " + errorThrown);
}
});
});
});
function buildURL(user, company, tranid)
{
var myurl = "${getLegacyUrl()}";
var pnames= "";
var pvalues = "";
pnames += "username:company:tranid:";
pvalues+= user + ":"+ company + ":" + tranid + ":";
pnames+= "total_claim_charge_amount:";
pvalues+= "${getFormattedTotalCharges()}";
}
I would like to move this code using RequireJS but I am not sure how to? My goal was once it is done, if user does a view source on my page those functions will not be shown. I tried using import using the context but I had no luck.
Any suggestions, advice will be most appreciated!