Murali Kumar Murali Kumar - 5 months ago 20
Ajax Question

Unable to insert ajax returned data into input field

The Ajax Request

type: "GET",
url: "http://localhost/CI2/index.php/login/testfunc",
data: {macro: selectedmacro},
async: false,
success: function (data) {


echo "This is a test";


<p id = 'p2'>fer</p>
<input type = "text" id = "tinyeditor" />

What Works:

works and replaces "fer" with "This is a test"

also works and inserts "data" string into the input field

The Problem

fails to insert "This is a test" into the input field. The field remains blank.

Sam Sam

First parse the data using JSON.parse(data) and try to insert.