Closer, still not working... I had 2 problems (I think).
#(this).serialize() was not serializing the form data.  I put my form
name in for the selector and now the form data is being passed to the
get. I think the other problem is that the action method doesn't match
my validator name.  My validator is set up as
Action-update-validation.xml.  So I added method ="update" to the
struts action definition. Now it appears to be trying to peform the
update instead of just performing the validation.

What exactly should be the chain of events happening here?  Shouldn't
it be something like the get invokes the validate() method, which
returns json data to the javascript callback where my alert is at?  I
would have suspected my callback method data to be populated with the
validation results.

On Fri, Apr 30, 2010 at 3:07 PM, Cimballi <cimba...@cimballi.net> wrote:
> I have something like that in the page :
>
> $.getJSON("...",
>  function(json) {
>    if (json.result == "OK") {
>      ...
>    } else {
>      ...
>    }
>  });
>
> And in the action I have this :
>    public String getResult() {
>        return this.result;
>    }
>
> In my case it's a single String but I suppose you can return more
> complex objects.
>
> Cimballi
>
>
> On Fri, Apr 30, 2010 at 2:51 PM, Ozu Natsu <ozu.na...@gmail.com> wrote:
>> I am having some problems with the call, the ajax "get" returns no
>> response, even though I know the form validation should be failing.
>> My ajax call looks like this:
>>
>>
>>        var url= "./checkValid.do";
>>        $.ajax({
>>                type    : "GET",
>>                cache   : false,
>>                dataType: "json",
>>                url      url,
>>                data    : 
>> $(this).serialize()+'&struts.enableJSONValidation=true&struts.validateOnly=true',
>>                success: function(data, textStatus, XMLHttpRequest) {
>>                        // do something here
>>                        alert(textStatus);
>>                }
>>        });
>>
>>
>> My action looks like this:
>>          <action name="checkValid" class="actionclass">
>>            <result type="json">
>>                <param name="root">jsonData</param>
>>            </result>
>>          </action>
>>
>> Am I missing something?
>
>
> --
> Cimballi
> JAVA J2EE Freelance
> http://cimballi.elance.com/
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to