结合使用jQuery mobile和ajax

I am trying to print a jQuery mobile thing using ajax but it doesn't encode the result as jQuery mobile is supposed to do.
This is a simplified version of the part of the javascript code that is supposed to do so:

   <script type="text/javascript">
       function changePage(task) {
           var objText = "";
           $.ajax({
               type: "POST",
               url: "DataFetch.aspx/FetchData",
               data: '{id: ' + <%=Session["loggedID"] %> + ', task: ' + task + ' }',
               contentType: "application/json; charset=utf-8",
               dataType: "json",
               success: function (response) {
                   var obj = JSON.parse(response.d);
                   if (task == 2)
                   {
                       objText += "<div data-role='collapsible'><h3>click me</h3><p>text</p></div>";
                   }
                   document.getElementById('content' + task).innerHTML = objText;
               }
           });

       }

</script>

How can I make it work? (when I write it explicitly in the html or outside the ajax functions it works but I need it to work with json)

Try changing

document.getElementById('content' + task).innerHTML = objText;

to

$('#content' + task).HTML(objText).enhanceWithin();

The enhanceWithin() call tells jQM to enhace the new content you added via AJAX: http://api.jquerymobile.com/enhanceWithin/