0

I want to append the myadd.php file result to textarea. Code is as shown below:

<textarea name="_to" spellcheck="false" id="_to" cols="70" rows="1" tabindex="2" autocomplete="off"></textarea>
<button type="submit" form="SubmitForm" onclick="loadSubmitResults('_to');">Submit</button>

<script language="javascript" type="text/javascript">
var urn='wdr';
function loadSubmitResults(to) {
var obj=document.getElementById(to);
var att = $().load('myadd.php?h='+urn);
obj.value+=att;
}
</script>

How does I should append the result of myadd.php file after typing some text in textarea?

1 Answer 1

1

Try this:

function loadSubmitResults(to) {
    var el = document.getElementById(to);
    $.get('myadd.php', { h: urn }, function(result){
        el.value += result;
    });
}

and change this:

onclick="loadSubmitResults('_to'); return false;"
Sign up to request clarification or add additional context in comments.

3 Comments

Tell me what you need
I had execute one php file, but sometimes, the result is submitted & sometimes not. I don't know what to do. How is this possible?
What do you mean result is submitted? Request is not sent to server? or server error occurs and returns status 500? Check network and console tabs for errors, in chrome developer tools (press F12).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.