title: jqGrid after Delete error
body: <p>Here is the example delete options I'm using using in a jqGrid.  It works just fine and my serverside scripts are working perfectly.  The records get deleted, but there is something that goes wrong after the response from the server is received.</p>
  
  <pre><code>// Del Options
  {
      mtype: "POST",
      modal: true,
      url: "/internal/backupmanagement/backupmanager/deleteMySQLDB",
      reloadAfterSubmit: false,
      onclickSubmit: function () {
          var post = $("#grid_" + o.id).jqGrid("getGridParam", "postData");
          var server = post.serverID;
          $.openDialog("load", "Deleting old database entry.  Please wait...");
          var selrow = $("#grid_" + o.id).jqGrid("getGridParam", "selrow");
          var row = $("#grid_" + o.id).jqGrid("getRowData", selrow);
          console.log("about to return", row, server);
          return {
              id: row.recid,
              database: row.database,
              server: server
          };
      },
      afterSubmit: function (response, postdata) {
          response = eval("(" + response.responseText + ")");
          console.log(response);
          return [true, "success"];
      },
      afterComplete: function (response, postdata, formid) {
          response = eval("(" + response.responseText + ")");
          var selrow = $("#grid_" + o.id).jqGrid("getGridParam", "selrow");
          $("#grid_" + o.id).jqGrid("delRowData", selrow);
          if (response.error == 0) {
              $.openDialog("info", "Successfully deleted " + postdata.database + ".");
          } else {
              $.openDialog("info", "And error occured - " + response.msg + ".");
          }
      }
  }
  </code></pre>
  
  <p>I get the following error before the afterComplete event is fired in the grid : </p>
  
  <pre><code>Uncaught TypeError: Object [object Array] has no method 'split'</code></pre>
  
  <p>So it seems something is being returned as an object when it was expecting a string.  I'm not sure if my response from the server is formatted correctly and I wasn't able to find any expected response in the documentation either.</p>
  
  <p><strong>* UPDATE *</strong>
  Server-side code as requested.  I've just included the controller function that interacts with the jqGrid, the rest is working and happening further on in the application.</p>
  
  <pre><code>function deleteMySQLDB()
  {
    if (IS_AJAX) {
      if (($this-&gt;Application-&gt;deleteMySQLDBData(
          $_POST["id"],
          $_POST["database"],
          $_POST["server"]
      )) === false) {
        echo json_encode(
            array(
              "error" =&gt; 1,
              "msg"   =&gt; "Failed Deleting record from database: "
                         .$this-&gt;Application-&gt;error
            )
        );
        return false;
      }
      echo json_encode(
          array(
            "error" =&gt; 0,
            "msg"   =&gt; "success"
          )
      );
      return true;
    } else {
      header("Location: /");
    }
  }
  </code></pre>
  
  <p>I hope this helps to see what I'm currently returning to the grid.</p>
  
  <p><strong>* UPDATE *</strong>
  What I have done is changed the source in the jqGrid plugin to include a toString() on the value before preforming the split.  </p>
  
  <p>On line 331 of jquery.jqGrid.min.4.3.1 :</p>
  
  <p>var A=[];A=H.split(",");</p>
  
  <p>Changed to :</p>
  
  <p>var A=[];A=H.toString().split(",");</p>
  
  <p>It seemed like a harmless change in the grand scheme of things and avoids arrays to be attempted to get split.  Thanks a lot for the help guys.  You certainly pointed me in the right place to start looking, Oleg!</p>