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

Multilayer CSV to filtered excel -

Listboxes in c# -

ios - Why must I define variables twice in the Header file? -