[ask] ajax page bisa open new tab

Forum diskusi mengenai client-side scripting Javascript dan framework-framework yang mendukungnya

Moderator: irzan2010

[ask] ajax page bisa open new tab

Postby skaterz99 » 12 Sep 2011, 14:57

[update} hahaha :)) :))
biasanya klo link di pilih open link in new tab/window yg d load cuma halaman tanpa index nya....
gmana caranya spy page & index bisa d load d new tab/window??
ada yang tau??
Last edited by skaterz99 on 14 Sep 2011, 10:07, edited 1 time in total.
skaterz99
Prajurit Dua
Prajurit Dua
 
Posts: 8
Joined: 12 Sep 2011, 14:41
Memberi kopi: 0 cangkir
Mendapat kopi: 0 cangkir

Re: [ask] ajax page bisa open new tab

Postby pujanggabageur » 12 Sep 2011, 15:38

Pusing amat, akhiran "nya" diganti "x", dikiranya mungkin forum ini isinya anak-anak alay semua @-) @-) @-)
Wajib hukumnya mematuhi Peraturan Memposting!
Diajar babarengan
User avatar
pujanggabageur
Global Moderator
Global Moderator
 
Posts: 2814
Joined: 13 Mar 2010, 14:15
Location: di depan LCD ViewSonic
Memberi kopi: 159 cangkir
Mendapat kopi: 293 cangkir

Re: [ask] ajax page bisa open new tab

Postby cyberzilla » 13 Sep 2011, 12:15

Om Agung, Klo Untuk Buka Tab Kosong Di Inochi Ribbon, Gimana yah Om..???
Image
====================================================================================
YM : cyberzilla@ymail.com
Google+ : cyb3rzilla@gmail.com
FB : http://www.facebook.com/albugisy
Twitter : @cyberzilla42
Plurk : http://www.plurk.com/albugisy/invite
User avatar
cyberzilla
Prajurit Dua
Prajurit Dua
 
Posts: 13
Joined: 09 Aug 2011, 14:45
Memberi kopi: 7 cangkir
Mendapat kopi: 0 cangkir

Re: [ask] ajax page bisa open new tab

Postby ekaperintis » 13 Sep 2011, 12:29

pujanggabageur wrote:Pusing amat, akhiran "nya" diganti "x", dikiranya mungkin forum ini isinya anak-anak alay semua @-) @-) @-)


Ohhhh jadi "x" itu artinya "nya", baru tau ane .... (bener-bener rusak ini bahasa) ^:)^
Image
User avatar
ekaperintis
Sersan Satu
Sersan Satu
 
Posts: 2086
Joined: 17 Mar 2010, 14:27
Location: Parungpanjang-Bogor
Memberi kopi: 82 cangkir
Mendapat kopi: 152 cangkir

Re: [ask] ajax page bisa open new tab

Postby skaterz99 » 19 Sep 2011, 14:26

sorry om,
biasa i2 kbiasaan anak muda skrg hemat karakter waktu sms.... hehehe :-j

ngomong2 ada yang bs bantu???
skaterz99
Prajurit Dua
Prajurit Dua
 
Posts: 8
Joined: 12 Sep 2011, 14:41
Memberi kopi: 0 cangkir
Mendapat kopi: 0 cangkir

Re: [ask] ajax page bisa open new tab

Postby pujanggabageur » 19 Sep 2011, 16:46

Kurang jelas om pertanyaannya

Tapi kalau menurut 'rabaan' ane, mungkin pengen bikin macam di CMS Wordpress...

Di Wordpress begitu klik link dia bakal menyertakan dua fungsi PHP yaitu get_header() & get_footer()

Jadi kayaknya lebih baik itu jadi wewenangnya PHP
Wajib hukumnya mematuhi Peraturan Memposting!
Diajar babarengan
User avatar
pujanggabageur
Global Moderator
Global Moderator
 
Posts: 2814
Joined: 13 Mar 2010, 14:15
Location: di depan LCD ViewSonic
Memberi kopi: 159 cangkir
Mendapat kopi: 293 cangkir

Re: [ask] ajax page bisa open new tab

Postby skaterz99 » 29 Sep 2011, 23:53

pujanggabageur wrote:Kurang jelas om pertanyaannya

Tapi kalau menurut 'rabaan' ane, mungkin pengen bikin macam di CMS Wordpress...

Di Wordpress begitu klik link dia bakal menyertakan dua fungsi PHP yaitu get_header() & get_footer()

Jadi kayaknya lebih baik itu jadi wewenangnya PHP


contohya kyk gini om
http://gawibowo.com/demo/jquery/ajax1.html

waktu klik link menu 1 - 4 content nya lagsung d ganti tapi klo linknya di plh open in new tab cuma content nya aja yg d load... page menu ga ada lagi....

gmana supaya waktu open di new tab ttp d load smuanya??

mohon bantuannya
skaterz99
Prajurit Dua
Prajurit Dua
 
Posts: 8
Joined: 12 Sep 2011, 14:41
Memberi kopi: 0 cangkir
Mendapat kopi: 0 cangkir

Re: [ask] ajax page bisa open new tab

Postby Rayzen » 30 Sep 2011, 03:20

wajr dong om, ketika di Open in New Tab yg terbuka cuman isi contentnya. soalnya yang dibuka hanya file Content.php. Kalau ingin menampilkan smua, linknya membuka file ajax1.html namun merjuk ke Content menu yang dipilih. mdah2an ngerti, om.
Kalau boleh, sourcenya di share om. Jadi ketahuan, yg perlu diperbaiki yang mana.
Tetto'ki ri lempu'e, aja' talesse ri tongenge.
User avatar
Rayzen
Prajurit Satu
Prajurit Satu
 
Posts: 244
Joined: 01 Apr 2010, 04:35
Location: Makassar
Memberi kopi: 16 cangkir
Mendapat kopi: 9 cangkir

Re: [ask] ajax page bisa open new tab

Postby pujanggabageur » 30 Sep 2011, 07:41

Betul kata om Rayzen, daripada tebak-tebakan mending dishare kodenya dimari.

Pemecahan kasus TS, begini:

Siapkan header, main container, dan footer. Header dan footer dapat berupa file bisa juga tidak, dan main content berupa elemen untuk menampung "respont text" dari ajax.

Contoh:

Code: Select all
<!-- Header -->
<body>
    <div id="menu">
        <!-- bla..bla..bla... -->
    </div>
    <!-- Main container -->
    <div id="content">
        <!-- di sini nantinya respont text dari ajax ditampilkan -->
    </div>
<!-- Footer -->
</body>
Wajib hukumnya mematuhi Peraturan Memposting!
Diajar babarengan
User avatar
pujanggabageur
Global Moderator
Global Moderator
 
Posts: 2814
Joined: 13 Mar 2010, 14:15
Location: di depan LCD ViewSonic
Memberi kopi: 159 cangkir
Mendapat kopi: 293 cangkir

Re: [ask] ajax page bisa open new tab

Postby skaterz99 » 30 Sep 2011, 20:20

msh blm ngrt omi, mklum newbie... :D

ini sourcenya codenya
file ajax1.html
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>jQuery Ajax</title>
<script type="text/javascript" src="jquery-1.2.3.pack.js"></script>
<script type="text/javascript">
$(function() {
   $('#loading').ajaxStart(function(){
      $(this).fadeIn();
   }).ajaxStop(function(){
      $(this).fadeOut();
   });

   $('#menu a').click(function() {
      var url = $(this).attr('href');
      $('#container').load(url);
      return false;
   });
});
</script>
<style type="text/css">
* { font-family: Verdana, sans-serif; }
div { font-size: 11px; }
#container { line-height: 20px; width: 500px; height: 500px; margin: 20px 0; padding: 10px; border: 1px solid #999; }
ul { padding: 0 }
li { display: inline; margin: 0 3px; }
#loading { position: absolute; top: 0; left: 0; color: white; background-color: red; padding: 5px 10px; font: 12px Arial; }
</style>
</head>
<body>
<div id="loading" style="display:none">Loading...</div>
<h4>jQuery Ajax</h4>
<div>
   <div id="menu">
      <ul>
         <li><a href="content.php?id=1">Menu 1</a></li>
         <li><a href="content.php?id=2">Menu 2</a></li>
         <li><a href="content.php?id=3">Menu 3</a></li>
         <li><a href="content.php?id=4">Menu 4</a></li>
      </ul>
   </div>
   
   <div id="container">
      Isi dari file content.php akan ditampilkan di sini
   </div>
</div>
</body>
</html>


file content.php
Code: Select all
<? if ($_GET['id'] == '1') : ?>

But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?

<? elseif ($_GET['id'] == '2') : ?>

On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains.

<? elseif ($_GET['id'] == '3') : ?>

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. <a href="content.php?id=4" onclick="$('#container').load($(this).attr('href'));return false;">Tes Menu 4</a>

<? elseif ($_GET['id'] == '4') : ?>

Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?

<? endif; ?>


mohon bantuannya.......
skaterz99
Prajurit Dua
Prajurit Dua
 
Posts: 8
Joined: 12 Sep 2011, 14:41
Memberi kopi: 0 cangkir
Mendapat kopi: 0 cangkir

Next

Return to Javascript and Framework

Who is online

Users browsing this forum: No registered users and 1 guest