Hi Vishu,

If your question is "how do I send JSON back to the client?", then I
would suggest the following:

- Let the system know that you want to send back JSON so that it will
set the right mime type on the response:

<rde-dm:attribute mode="write" attribute="request:rdeResponseMimetype"
op="set" value="application/json"/>

- Use an XSLT stylesheet as you would normally to transform the
DynaMent's output but in this case to an output of JSON. Here's an
example of a stylesheet I use in this way on the www.solutionexchange.info
community site:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/
Transform" xmlns:atom="http://www.w3.org/2005/Atom";>
    <xsl:output method="html" encoding="UTF-8" />
    <xsl:template match="createNewPage">{"pageGuid":"<xsl:value-of
select="//createdPageGuid" />","errorMsg":"<xsl:value-of select="//
errorMsg" />","digest":"<xsl:value-of select="//digest" />"}</
xsl:template>
</xsl:stylesheet>

- Within your client side jQuery, you would need to ensure you call
the xml with the xsl in the fuller Delivery Server URL structure
(unless you mask that through your front controlling web server -
http://bag.gs/ad3oai).


Hope this helps,

Dan
On Apr 26, 3:51 pm, vishu <[email protected]> wrote:
> Hi All,
>
> I am using the Red Dot delivery server. In which i use the dynaments
> to query the database for some form on my website.
>
> I have requirement in which i have to make a ajax call to the dynament
> xml and get the response back.
>
> Is there a way i can send the response to the client ? if yes . How do
> i read it my ajax method.
>
> My ajax method looks something like below.
>
> function checkSupply(postcode) {
>     if (!jQuery('#'+postcode).val().match(/^[A-Za-z]{1,2}[0-9A-Za-z]
> {1,2}[ ]?[0-9]{0,1}[A-Za-z]{2}$/)) return;
>     document.body.style.cursor = 'wait';
>    alert("2");
>    alert(jQuery('#'+postcode).val());
>     jQuery.ajax({
>         type: 'POST',
>         url: 'default.xml',
>         data: { post_code : jQuery.trim(jQuery('#'+postcode).val()) },
>         success:addressSearchResponse,
>         error: addressSearchError
>     });
>            alert("3");
>
> }
>
> function addressSearchResponse(pcode) {
>
> }
>
> function addressSearchError(xhr, status, error) {
>
> }
>
> Can somebody help me on this.
>
> Thanks in advance

-- 
You received this message because you are subscribed to the Google Groups 
"RedDot CMS Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/reddot-cms-users?hl=en.

Reply via email to