Now I am creating a few plugins for WordPress. All need to work separately, but I want to add an implementation to have them work together.
For starters, all the script will use a custom name to reference jQuery, that is the first part where my problem start. In WordPress I have a combined object that I want to populate with all the values. The combined object is named: myObject
.
Now I try this but it does not work:
if( typeof myObject.jq !== 'undefined' )
myObject.jq = jQuery.noConflict();
myObject.jq(document).ready(function(){
}
I get the error message 'myObject.jq' is not a function.
I want to further expand this with a combined ajax function, like this
if( typeof myObject.jq !== 'undefined' ){
myObject.jq = jQuery.noConflict();
myObject.ajaxcall = function(action){
var dfr = myObject.jq.Deferred();
myObject.jq.ajax({
url:myObject.ajaxurl,
type:'post',
data:{
action:action,
face:myObject.face
},
dataType:'json',
success:dfr.resolve
});
return dfr.promise();
};
}
myObject.jq(document).ready(function(){
// My code here
}
This completely does not work. Anyone have any idea how I can get this working?