Question: I would like to replace only the 3rd `}` in the below script to `]`. 

```
 "objectLocationHeight" : "46.500000",
    "text" : "1494"
  },
  "timestamp" : "2015-10-09 12:50:58",
  "eventType" : "keyboardOnAnsBox",
  "action" : "endTyping"
}
  },
"submitTime" : "

```

The following is the target result

```
 "objectLocationHeight" : "46.500000",
    "text" : "1494"
  },
  "timestamp" : "2015-10-09 12:50:58",
  "eventType" : "keyboardOnAnsBox",
  "action" : "endTyping"
}
  ],
"submitTime" : "

```

However, it seems that the 'replace' function can only work within a line and I couldn't get the desired result with 

```
str1= str.replace("},\n\"submit","],\n\"submit")

```

May I know if there is other syntax that allows me to perform `replace` across lines?

Answer: 
use `.ready()`, for this,

```
<script>
     $(document).ready(function(){
        $("#myDiv").load('page_going_somewhere_else.php');
     });
</script>

```

If you want to load in every x time, try like this, Its bettter to use ajax

```
$(document).ready(function () {
    setInterval(function() {
        $.get("page_going_somewhere_else.php", function (result) {
            $('#myDiv').html(result);
        });
    }, 10000);
});

```
you can call it in your window.onload event or any other DOM events.

```js
window.onload=function(){
$("#myDiv").load('page_going_somewhere_else.php');
  };
```