user782104 user782104 - 4 months ago 7
jQuery Question

How to replace string in the website after PHP have complete the processing

For example , the is a word 'cat', and I would like to change to 'dog' in every page,

but in server side:


or in cilent side:

doc.replace("cat", "dog");

I need to provide the doc variable, is it possible to just auto search and find the server processed result and replace the word in every page?

It may also changed the code in javascript and lead to error , but to simplify , just assume the jquery doesn't have function name/ variable using 'cat'

Thanks a lot for helping.


Thanks for the answer. Last question, if I use framework such as codeigniter, where should I put the ob buffer code?


In controller?

function index() {
$data['demo_data'] = $demo_data;


I think it's all meaningless, but it works

 document.documentElement.innerHTML = 

About codeigniter

function index() {
    $data['demo_data'] = $demo_data;
    //  Add 3rd argument as true to get output muffer
    $text = $this->load->view('test',$data, true);
    // Any manipulations with text
    echo $text;