开发者

jQTouch loading external PHP not working proparly

I really hope someone can help me with my problem. Because I am really stuck rightnow. I am trying to do a wepApp with jQTouch. The truble I am having is loading data from a mysql Database. It used to work but then I updated the jQTouch Package to add on some extensions. So now the wierdest thing is happening. When I load the external data with the safari on the iPhone the mysql data want be l开发者_JAVA百科oaded. But if I add the page to the homescrean of the iPhone it works. How is this possible?

Anyway, here is the code:

$(document).ready(function() {
 $("#admin li.arrow a, #kauf #adminAll, #tech #techAll, #dienst #dienstAll, #verkauf li.arrow a, #verkauf li.arrow a, #finanz li.arrow a, #informatik li.arrow a, #masch li.arrow a, #bau li.arrow a, #gewerbe li.arrow a, #med li.arrow a, #lebensmittel li.arrow a").tap(function (){
  var linkId = $(this).attr("id");
  //alert(linkId);
  $('#liste').empty(); 
  $.ajax({
    type: "GET",
    //cache: "false",
    url: "listJobs.php",
    data: "ajaxget=" + linkId,
     success: function(data) {
      //$("#liste").load(data);
      jQT.goTo('#liste');
    }
  });
   return false;
});     
});         

I also tryed to write a tap function, but I had no success on that. So If anyone could give me a pointer on that, I would also highly aprechiate it.

And here the php:

        <div class="toolbar">
         <h1>smart personal</h1>


<?
$kat=$_GET["ajaxget"];

echo  "<a class='back slide'>Zurück</a>
        <a class='button flip' id='infoButton' href='#home'>Home</a>
    </div>
    <div class='s-scrollwrapper' momentum='false' vScrollbar='false'>
      <div>";

echo "<ul class='rounded'>";
echo "<li class='suche'>Ihre Suche ergab <span class='zahl'>$numrows</span> Treffer</li>";





while($row = mysql_fetch_array($resultOutput)) {

$id=($row['stelleID']);
$datumsanzeige=($row['stelleDatumsanzeige']);
$datum=(date("d.m.y", strtotime($row["stelleDatum"])));
$today = date("d.m.y");

if($datumsanzeige == "fake")
    {
    $datumDef = "$today";
    }
  else
    {
    $datumDef = "$datum";
    }


// Print out the contents of each row into a table
    echo "<li><a href='stellenDetailiPhone.php?stelleID=$id'>";
    echo $row['stellePosition'];
    echo "</a><a class='nobg slide' href='stellenDetailiPhone.php?stelleID=$id'>";
    $stelleIDDetail = $row['stelleID'];
    $text=strip_tags (html_entity_decode($row['stelleStellenbeschrieb']));
// 0,100 show 100 Zeichen
    echo substr($text,0,50);
    echo "</a></li>";
    } 


echo "</ul></div></div>";

echo mysql_error();
mysql_close($con);


It looks like your jQuery bit is not doing anything with the data returned via AJAX:

First things first, check whether any data is being returned by the AJAX call.

1) Go to the URL directly in your browser and look at the results. If all looks good there, then...

2) Adjust your jQTouch bit to:

$(document).ready(function(){

  $("#admin li.arrow a, #kauf #adminAll, #tech #techAll, #dienst #dienstAll, #verkauf li.arrow a, #verkauf li.arrow a, #finanz li.arrow a, #informatik li.arrow a, #masch li.arrow a, #bau li.arrow a, #gewerbe li.arrow a, #med li.arrow a, #lebensmittel li.arrow a")
    .tap(function(){
      var linkId = $(this).attr("id");
      //alert(linkId);
      $('#liste').empty();
      $.ajax({
      type: "GET",
      //cache: "false",
      url: "listJobs.php",
      data: "ajaxget=" + linkId,
      success: function(data) {
        console.log( data );
        //$("#liste").load(data);
        jQT.goTo( '#liste' );
      }
    });
    return false;
  });

});

And test it with your (assumedly iPhone/iPod/iPad's) Debug Console on - go to Settings > Safari > Developer > Debug Console to ON. If the AJAX action is called, and data is returned, you should see a message at the top of the browser window.

Also, you are using (or have commented out) a call using the jQuery $.load() function. That function basically does the AJAX action for you, you simply give it the container to fill and the URL (and optionally element) to fill it with. So you might find the following will do the job just as easily:

$(document).ready(function(){

  $("#admin li.arrow a, #kauf #adminAll, #tech #techAll, #dienst #dienstAll, #verkauf li.arrow a, #verkauf li.arrow a, #finanz li.arrow a, #informatik li.arrow a, #masch li.arrow a, #bau li.arrow a, #gewerbe li.arrow a, #med li.arrow a, #lebensmittel li.arrow a")
    .tap(function(){
      $("#liste").load( 'listJobs.php?ajaxget='+$(this).attr("id") );
    return false;
  });

});

As I mentioned earlier, it looks like your #liste element is being emptied, but no new content is being added through the AJAX call - you are simply moving to that element if/when the AJAX call is successful.

Anyway, it's a start for you to be able to continue debugging/troubleshooting.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜