Q:

Explode in jquery with php

I've got a jquery script, which creates a h3 tag and print a variable called result.tbUrl to it. I'd like to explode the variable at "::" and use the 2nd piece.
This is my method.
var link = document.createElement('h3');
link.innerHTML = <?php $link = "result.tbUrl"; $linkpiece = explode("::", $link); echo $pieces[1]; ?>;

Could you tell me please where did i make a mistake?

A:

The first problem is, you're echoing $pieces[1], but exploding your string into $linkpiece which is a different variable.
However, you have a more serious problem: You're setting $link to the string "result.tbUrl".  The string doesn't contain the delimiter '::', so exploding it has no effect and $linkpiece will be set to array(0 => 'result.tbUrl').  The line echo $linkpiece[1] will fail regardless, as there is nothing at index 1.
If result.tbUrl is a JavaScript variable, you cannot mix it with server-side PHP this way.  You'll have to explode the variable client-side, in JavaScript:
var parts = result.tbUrl.split('::');
link.innerHTML = parts[1];

