Hit the ajax url directly to see what data Mason is serving, and post  
that.

You should probably return after emitting $json->encode to prevent it  
from outputting extra stuff, but that may or may not be the problem.

On Nov 13, 2009, at 4:00 PM, Ogden wrote:

> I am guessing this is broken because I cannot do it simply by:
>
> <%init>
> .....
>
> $m->clear_buffer();
> $r->content_type("application/json");
>
> use JSON;
> my %json;
>
> # Build data structure
> </%init>
> <% $json->encode(\%json) %>
>
>
> My javascript:
>
> <script type="text/javascript">
> function searchNews() {
>    $.ajax({
>                type     : "POST",
>                url      : "json_retrieve_news.ml",
>                dataType : "json",
>                data     : {
>                    'lookup_id' : $('#lookup_id').val(),
>                    'month' : $('#month').val(),
>                    'day' : $('#day').val(),
>                    'year' : $('#year').val()
>                },
>                success  : function(data) {
>                                alert( 'worked: ' + data.row_count );
>                },
>                 error : function() {
>                          alert(' No results were found. Please try  
> again.');
>                 }
>
>                });
>
> }
>
>
> No matter what I am always getting the alert with the "No results were
> found" message.
>
> I'm guessing this has to do with how Mason is returning the JSON.
>
> Any help/clues?
>
> Thank you
>
> Ogden
>
>
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008  
> 30-Day
> trial. Simplify your report design, integration and deployment - and  
> focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Mason-users mailing list
> Mason-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mason-users


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to