I’m using jquery ajax can i use php code in success: function(html){} ??
I’m using jquery ajax can i use php code in success: function(html){} ??
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, not directly, as JavaScript ist executed on the client side, and PHP is executed on the server.
A workaround would be to send another AJAX-Request from your success-function. But it can only do things on the server side, not on the client side.
If you just want to download a file from your callback function, use
location.href = url. The URL can be a server side PHP script serving the data stream, or a real file.