javascript - Ajax - Render JSon to HTML : View vs Controller -


i want append results of ajax request table have on page. see 2 ways of rendering rows :

  • my controller return json array decode in view , create javascript function add adequate html markup

  • my controller directly return html

what best practice on matter?

i use ways

  • send ajax php file datatype: 'json'

  • at php: processing data , json_encode data array , die return result html

  • on success function of ajax, process data


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -