In drupal.js 4.7 there is a HTTPGet, it's not existing in 5.0.
Or the function got by accident forgotten, or (more likely) there is a new 5.0 way to work with it. I'm using this function for Ajax stuff, so it seams important.
However I didn't find any info on the 4.7 => 5.0 page or any other page to explain me how to work with it now. It may be hidden in other information, maybe its just a problem of visibility?
Comments
Comment #1
cburschkaThat's the function you're looking for.
Comment #2
cburschkaI missed the Javascript bit and thought you were talking about the PHP API. Disregard the above.
Comment #3
cburschkaErm. I'm new to the issues, I guess. Here's the original title restored.
Comment #4
Anonymous (not verified) commentedhey mixel..
with having jQuery now in 5.. we don't need this method anymore.
jQuery has better ways of handling AJAX..
there is now $.ajax(); or $.get();
both will do what you want.
to find out jQuery methods, visit: http://jquery.com/api/
everything in it has examples so it's right easy to pick up. hope that helps.
Comment #5
profix898 commentedComment #6
mixel commentedwell tried the $.get and $.ajax stuff. there are several examples, but a simple httpget ... didn't got it working got "undefined" all the time. I simply whant this:
thisid = jqselect_HTTPGet(url);
where the "url= http://www.knosos.be/update5/?q=ajax/check_user_name/mixel"
it should return an id or "false", but I'm not gething any thing.
What I did learn is that I could use more jquery functions to make my script look nicer. Don't think I'll have the time for it sadly
Comment #7
mixel commentedow, copy past the HTTGET to a local function jqselect_HTTGET for the moment to make the script work
Comment #8
scroogie commentedPerhaps we can help you when you specify a bit more what you want to do. When it didnt work with get(), did you get errors in your javascript console?
Comment #9
Steven commentedmixel: I suggest you look at a usage of HTTPGet in Drupal 4.7 .js, and look at the equivalent code in Drupal 5.0. The jQuery API changes are too numerous to mention sadly... there is plenty of code which can be optimized with it.
But, feel free to update the module upgrading guide with a specific snippet for HTTPGet, if you think it would be useful.
Comment #10
mixel commentedThat was a good idea Steven.
I found a example in autocomplete.js where the 'search' is using the ajax in 5.0 and the HTTPGET in 4.7.
My problem stays however, always got tot the 'error' part of the ajax never the 'success'. My problem I belief is with the url, some how I never get it there. The url is:
"http://www.knosos.be/update5/?q=ajax/check_user_name/mixel" (mixel is the input part)
The problem I think is that the ajax you don't need to specify the path (seen it in other examples) but I'm not sure what that means, displaying the "this.uri" gives undefined and I'm thinking it may be the current path of the module that may (.../update5/module/...). Giving the whole url doesn't work, only the query part doesn't work, testing the moduel dir didn't work ... I simply have no clue.
Comment #11
scroogie commentedCan you try the following just as a test?
Comment #12
mixel commentedyour sugestion did give me results, so tnx.
I couldn't really run the code, so can't give feedback on that, the next code worked:
$.ajax(
{
type: "GET",
url: "/update5/index.php/?q=ajax/check_user_name/mixel",
success: function (thisid)
{
alert('Data '+ thisid);
},
error: function (xmlhttp)
{
alert('An HTTP error '+ xmlhttp.status +' occured.\n'+ this.uri);
}
Comment #13
mixel commentedforget to close the the ajax past so add:
});
Comment #14
(not verified) commented