Hello people.
I have a website portal where I am trying to delete an object, by pressing a button. It does not work and I am getting an error. The HTML part of the request is following:
[HTML]<a href="javascrip t:makeRequest(' set/post.php?actuee l&del&[[ID]]');" onclick="return confirm('Weet u zeker dat u dit item wilt verwijderen?')" onmouseover="dr agable = false" onmouseout="dra gable = true"><img src="[[URL]]images/delete.jpg" height="20" width="20" border="0" alt="Verwijdere n / Delete" align="absmiddl e"/>[/HTML]
Where ID will be replaced by the record identifier.
makeRequest on Javascript looks like following:
[code=javascript]
function makeRequest(url ,object) {
xhr = new XHR(url,object) ;
}
//Constructor
function XHR(url,object) {
var http_request = null;
this._load(url, object);
}
XHR.prototype._ load = function(url,ob ject) {
/*var _this = this;
this.http_reque st.onreadystate change = function(){_thi s.getRequest()} ;
this.http_reque st.setRequestHe ader("Content-Type","applicat ion/x-www-form-urlencoded");
this.http_reque st.send('xml=<r oot>' + ((object!=false )?get(document. getElementById( object)):'') + '</root>');*/
if (document.getEl ementById('text area_url')){
document.getEle mentById('texta rea_url').value += url + "\n\n" + ((object!=false )?get(document. getElementById( object)):'');
}
var xml = ((object!=false )?get(document. getElementById( object)):'');
$.ajax({
type: "POST",
url: url,
data: 'xml=<root>' + xml + '</root>',
async: false,
complete: function(msg){
if (document.getEl ementById('text area_code')) document.getEle mentById('texta rea_code').valu e = msg;
try {
//alert();
var output = msg.responseXML .documentElemen t;
process(output) ;
} catch(e) {
//alert('niet goed');
}
}
});
}[/code]
The error message in Birebug is following:
$.ajax is not a function
_load("set/post.php?actuee l&del&17", undefined) javascript.js (line 61)
XHR("set/post.php?actuee l&del&17", undefined) javascript.js (line 41)
makeRequest("se t/post.php?actuee l&del&17", undefined) javascript.js (line 35)
[Break on this error] complete: function(msg){
Which makes me think that the 'object' parameter is undefined. This brings me to the real problem - the makeRequest works perfectly with other part in the code (when sending mail). So I cannot completely remove the parameter, but make some changes. This is the point where I don't how to change the code? Any help will be appreciated and more information will be provided.
I have a website portal where I am trying to delete an object, by pressing a button. It does not work and I am getting an error. The HTML part of the request is following:
[HTML]<a href="javascrip t:makeRequest(' set/post.php?actuee l&del&[[ID]]');" onclick="return confirm('Weet u zeker dat u dit item wilt verwijderen?')" onmouseover="dr agable = false" onmouseout="dra gable = true"><img src="[[URL]]images/delete.jpg" height="20" width="20" border="0" alt="Verwijdere n / Delete" align="absmiddl e"/>[/HTML]
Where ID will be replaced by the record identifier.
makeRequest on Javascript looks like following:
[code=javascript]
function makeRequest(url ,object) {
xhr = new XHR(url,object) ;
}
//Constructor
function XHR(url,object) {
var http_request = null;
this._load(url, object);
}
XHR.prototype._ load = function(url,ob ject) {
/*var _this = this;
this.http_reque st.onreadystate change = function(){_thi s.getRequest()} ;
this.http_reque st.setRequestHe ader("Content-Type","applicat ion/x-www-form-urlencoded");
this.http_reque st.send('xml=<r oot>' + ((object!=false )?get(document. getElementById( object)):'') + '</root>');*/
if (document.getEl ementById('text area_url')){
document.getEle mentById('texta rea_url').value += url + "\n\n" + ((object!=false )?get(document. getElementById( object)):'');
}
var xml = ((object!=false )?get(document. getElementById( object)):'');
$.ajax({
type: "POST",
url: url,
data: 'xml=<root>' + xml + '</root>',
async: false,
complete: function(msg){
if (document.getEl ementById('text area_code')) document.getEle mentById('texta rea_code').valu e = msg;
try {
//alert();
var output = msg.responseXML .documentElemen t;
process(output) ;
} catch(e) {
//alert('niet goed');
}
}
});
}[/code]
The error message in Birebug is following:
$.ajax is not a function
_load("set/post.php?actuee l&del&17", undefined) javascript.js (line 61)
XHR("set/post.php?actuee l&del&17", undefined) javascript.js (line 41)
makeRequest("se t/post.php?actuee l&del&17", undefined) javascript.js (line 35)
[Break on this error] complete: function(msg){
Which makes me think that the 'object' parameter is undefined. This brings me to the real problem - the makeRequest works perfectly with other part in the code (when sending mail). So I cannot completely remove the parameter, but make some changes. This is the point where I don't how to change the code? Any help will be appreciated and more information will be provided.
Comment