Michelle Michelle - 24 days ago 7
jQuery Question

Render PHP with jQuery instead of Handlebars?

I have already in my software Handlebars in using, but I'm not so familiar with it, so it is possible to render a PHP file instead of Handlebars file?

The code is:

loadFormTemplate = {
main: Handlebars.compile($('#load-form').html()),
error: Handlebars.compile($('#form-error').html()),
info: {
formBox: Handlebars.getTemplate('formbox')
}
};


Simple to edit name in getTemplate() of course. not works.

Answer

You can use jQuery .load() function to load a PHP file.

More info: http://api.jquery.com/load/

$("#your_div").load("test.php");