I am trying to write a simple chrome extension that receives input
from the user via an input text box. It sends that input to a php
page that will generate some results and then display the results
right below the input box.
I'm using XMLHttpRequest to run the PHP page but the response that I
am getting back is empty (according to the console). If I alert the
responseText then it will show the raw php code. This works perfectly
if I just load the popup.html in chrome but does not work if I load it
in the extension or if I load it using chrome-extension://<id>/
popup.html.
This php request is not cross-origin. The php page is in the exact
same folder as the popup.html.
Here is my request code:
var req;
function goGet(){
req = new XMLHttpRequest();
req.open("GET", "autocomplete.php?value=testValue", true);
req.onload = handleResponse;
req.setRequestHeader('Content-Type', 'application/x-www-form-
urlencoded');
req.send(null);
}
function handleResponse() {
var doc = req.responseText;
alert(doc); //Returns the raw PHP code
var content = document.getElementById('content');
content.innerHTML = doc;
}
Thanks for any help.
--
You received this message because you are subscribed to the Google Groups
"Chromium-extensions" 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/chromium-extensions?hl=en.