trying to use $.post
trying to use $.post
I am trying to use $.post() to perform ajax functions
the bit i am having difficulty with is the callback function
all of the pieces of documentation i find for it (i have read several) give examples with this syntax.
$.post("demo_test.asp",function(data,status){
alert("Data: " + data + "\nStatus: " + status);
});
as you can see the function is defined within the $.post() parameters.
however i dont like writing my functions into the properties of jquery methods like this because i think it looks messy and i want the function to be available to other parts of the script. so I would rather do it like this
$.post("demo_test.asp",dothis(data,status));
function dothis(data,status)
{
alert("Data: " + data + "\nStatus: " + status);
{
but i cant seam to get the syntax correct to make it work this way
how do i fix this?