On Dec 15, 2007 5:32 AM, Mario Moura <[EMAIL PROTECTED]> wrote:
> Hi Richard
>
> Thanks a lot. I will start read John Resign Book and study a lot
> JavaScript.
It will be time well spent. Great language. Great book.
> Yes the solution is declarate the variable before but I would like this
> va
Hi Richard
Thanks a lot. I will start read John Resign Book and study a lot JavaScript.
Yes the solution is declarate the variable before but I would like this
varaible be global.
I dont recommend use var because will turn it local
So I did
$(document).ready(function(){
check1 = null;
On Dec 14, 1:06 pm, "Richard D. Worth" <[EMAIL PROTECTED]> wrote:
> $("#target").ajaxSuccess(function(request, settings) {
> if (check1 == "something") {
> $(this).append(check1);
> }
>
> });
I believe the first parameter for ajaxSuccess functions is the event.
Then comes the request and
Let's start with a simple example:
function alertData(data) {
alert(data);
}
//named callback function
$("#mychild").ajaxForm({
success: alertData
});
Notice I just give success the name of my function - alertData. No function
keyword, no parens, no curly braces. I'm actually passing the fun
Something like this?
var check1;
$("#ajax").ajaxForm({
success: function(data) {
check1 = data;
}
});
$("#target").ajaxSuccess(function(request, settings) {
if (check1 == "something") {
$(this).append(check1);
}
});
That's untested, but should work, so hopefully it's a starting
Almost, the problem is always "check1 is not defined"
Example:
function checked(check) {
this.check = check
}
$("#ajax").ajaxForm({
success:
function(data) {
check1 = new checked(data)
// do stuff with data;
Wow, thanks a lot Richard
I can do this with php (quite simple) but I am lost with Jquery / Javascript
syntax. Could you help me?
Example
$("#mychild").ajaxForm({
success:
function(data) {
// do stuff with data;
function toCheck() {
You could declare a function and give it a name, instead of using an
anonymous function, then pass that as the success function for each ajax
call.
- Richard
On Dec 14, 2007 8:51 AM, Mario Moura <[EMAIL PROTECTED]> wrote:
> No.
>
> Let me explain better.
>
> In your scenario you made a individua
No.
Let me explain better.
In your scenario you made a individual AJAX request and into this request
you create rules.
But JQuery could create an universal AjaxSucess to test all data from all
ajax requests.
So imagine this scenario:
The page have a lot of AJAX requests, something like ajaxfo
Don't know if I understood,
$.ajax({"type": "POST",
"url": " foo2.php",
"data": data,
"dataType": "json",
"success": function(server_response) {
switch(server_response.wich_function) {
case '1':
on_success_one(server_response);
10 matches
Mail list logo