/    Sign up×
Community /Pin to ProfileBookmark

Help determining what this code does

Hi –

Can someone please give me an idea what this code does and if “Origin” is of any real significance or not? I thought it had to do with origin-only JSON GETting but, I’m not certain.
Thx!

Origin.onAction(‘sanAreaCodes’, function () {
var cntrl = $(this);
$(this).after(‘<p class=”loading”>Loading…</p>’);
$.post(‘/San/AreaCodes’,
{ sanNumber: $(this).attr(‘data-san-number’) },
function (result) {
Origin.modal({
content: $(result),
title: “Your Approved Area Codes”,
open: function () { cntrl.siblings(“p.loading”).remove(); }
});
});
});
//
//
//
Origin.onAction(‘sanInfo’, function () {
var view = $(this).attr(‘data-view’);
var title = $(this).attr(‘title’);
Origin.modal({
url: ‘/San/GetContent/’ + view,
title: title,
buttons: [{
label: ‘Ok’,
click: function () {
$(this).originModalClose();
},
type: ‘primary’
}]
});
});


——–

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@jsbensonNov 09.2015 — Looks like widgets.

"Origin" - object

"onAction" - 1st widget

'sanInfo" - widget function

", function()" - argument being passed to the "sanInfo" function that has a "click" listener

After view and title are populated another widget "modal" is attached to the "Origin" object

the "modal" widget accepts "option" parameters, which is what "url", "title", "buttons", "label", and "click" are

the "modal" widget probably looks like this:


[CODE];(function($,window,document,undefined){
$.widget("ui.modal",{
options:{
url:"",
title:"",
buttons:{
label:'',
click:{}
}
},

//----------------- CREATE WIDGET -------------------------
_create:function(){
var $this=this;
var $el=$this.element;

etc...

},[/CODE]


Hope that helps
Copy linkTweet thisAlerts:
@jsbensonNov 09.2015 — "Origin" has nothing to do with ajax functionality. It's just the object or element. Could be a little window on the page name "Origin"
Copy linkTweet thisAlerts:
@NdnaJnzauthorNov 10.2015 — Thanks immensely for taking the time to explain this. I guess the word "origin" is mainly what threw me; it seems like an odd name for this type of object.

Much appreciated!
Copy linkTweet thisAlerts:
@jsbensonNov 10.2015 — You bet :-)
×

Success!

Help @NdnaJnz spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...