Ajax Request problem?

  • I want to have AjaxRequest and after that show result of action page by innerhtml but I can not do it?
    This is code that I use?

    PHP
    function sentPost()
    {
    var ajaxRequest = new AjaxRequest();
    ajaxRequest.openPost('index.php?action=AddPost&t='+SECURITY_TOKEN+SID_ARG_2ND);
    $('newpost').innerHTML = ajaxRequest.xmlHttpRequest.responseText;
    }


    when I use
    alert(ajaxRequest.xmlHttpRequest.responseText);
    before
    $('newpost').innerHTML = ajaxRequest.xmlHttpRequest.responseText;
    function work well.
    And one thing how can I send data?

  • You use protoaculous.1.8.2.min.js for ajax request and yet it doesn't work for me! and I don't know why?
    note I get my data with this line:

    PHP
    var postdata = "text=" + encodeURI( $("text").value ) + "&threadID=" + encodeURI('{@$thread->threadID}');


    can you explain more for using protoaculous?

  • I get:
    Fatal error: Template compilation failed: unknown tag {text: $('text').value,threadID: threadID} in template 'thread' on line 14

    PHP
    function sentPost() {
    var threadID = '{@$thread->threadID}';
    new Ajax.Request('index.php?action=AddPost&t='+SECURITY_TOKEN+SID_ARG_2ND, {
    method: 'post',
    parameters: {text: $('text').value,threadID: threadID},
    onSuccess: function(transport) {
    $('newpost').update(transport.responseText);
    }
    });
    }


    Can I use WCF ajax request I think it is much easier than prototypejs.

  • No need for literal!

    HTML
    function sentPost() {
    new Ajax.Request('index.php?action=AddPost&t='+SECURITY_TOKEN+SID_ARG_2ND, {
    method: 'post',
    parameters: { text: $('text').value,threadID: {@$thread->threadID} },
    onSuccess: function(transport) {
    $('newpost').update(transport.responseText);
    }
    });
    }