0

I need to retrieve data from a MySQL database, and have it work one way for all types of servers. For example it should work on a server that runs no server side language, it should also work on LAMP, and IIS.

I was thinking about using ajax and xmlhttprequest, but learned of the cross domain limitation. I also tried to just include the PHP in a tag, but it comes back with a syntax error in the HTML code created by the PHP file, even though it looks correct.

Does anyone know how to fix either of these issues, or have a different way to go about it?

1 Answer 1

0

If you use the cross-domain ajax, the result should be straight JavaScript code, and should not contain any HTML whatsoever. This page has a description of the technique for cross-domain ajax.

See Also: How to access different domain data using Java script

Sign up to request clarification or add additional context in comments.

2 Comments

I've gone with the 2nd link on using jSON, but I'm still running into similar errors. What I'm trying to do is pull text and a url from a database and write <a> tags with the results. I'm basically creating the string in PHP and then echoing that out, but it says Error: missing ; before statement, and idea what I'm doing wrong?
here's the code... $categories="<a href=" . '"' . "?catID=" . $row['catID'] . '"' . ">" . $row['CatName'] . "</a><br>"; echo $_GET['jsoncallback'] . '(' . $categories . ');';

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.