title: The json encode did not return response after calling the function of fb post to wall
body: <p>I have a link which posted data to another page <code>vote.php</code> through jquery.</p>
  
  <p>When I click on that link, it return the state according to the condition.
  If that user posted the vote before then it displayed the "already voted" other wise "Your vote posted".</p>
  
  <p>All was working fine. </p>
  
  <p>I am using the facebook post to wall sdk.</p>
  
  <p>Now when I call the <code>fb_publish_on_wall</code> function from the vote.php, the message successfully posted to my fb wall but it did not return the state of the vote like "Your vote posted".</p>
  
  <p>What is the problem. When I comment out that line where I am calling the <code>fb_publish_on_wall</code> function then It works fine.</p>
  
  <p>I think the jquery did not get response from <code>vote.php</code> after calling the <code>fb_publish_on_wall</code> function.</p>
  
  <p>How will I fix this?</p>
  
  <p>UPDATED: Here is the fb_publish_on_wall function</p>
  
  <pre><code>function fb_publish_on_wall($message,$link,$picture,$name,$description,$user_facebook2)
  {
      $message = str_replace(array('&lt;br /&gt;', '&lt;br&gt;'), "\n", $message);
          $description = str_replace(array('&lt;br /&gt;', '&lt;br&gt;'), "\n", $description);
          $name = str_replace(array('&lt;br /&gt;', '&lt;br&gt;'),"\n", $name);
          $link = str_replace(array('&lt;br /&gt;', '&lt;br&gt;'), "\n", $link);
  
          global $facebook;
  
                  $publishStream = $facebook-&gt;api("/$user_facebook2/feed", 'post', array(
                      'message' =&gt; "$message", 
                      'link'    =&gt; "$link",
                      'picture' =&gt; "$picture",
                      'name'    =&gt; "$name",
                      'description'=&gt; "$description"
                      ));
  
          print $user_facebook2;
  
  
  
  }
  </code></pre>
  
  <p>UPDATED: vote.php. This file is big. SO I am only displaying the that two lines from vote.php</p>
  
  <pre><code>echo json_encode(array("state"=&gt;"&lt;span style='color:#8DA326'&gt;".l("Your vote posted").".&lt;/span&gt;"));
  
      fb_publish_on_wall($message,$link,$picture,$name,$description,$user_facebook2); 
  </code></pre>