-4
我有問題,當我嘗試在location.hash
現有的網址中添加新的參數。增加新的兩個參數後哈希符號全自動添加到URL #
當嘗試添加網址參數時Jquery添加散列符號
我有鏈接:http://work.example.rs/index.php/profile/photos
上點擊我打開其中i加載最大尺寸的圖像,並添加新的參數去URL像photo_id
和photo_guid
preview: function() {
$('body').on('click', '#open-picture-modal', function (e) {
e.preventDefault();
var $this = $(this);
var guid = $this.data('guid');
var photo_id = $this.data('id');
var url = baseurl + '/picture/preview/?pgid='+guid+'&pid='+photo_id;
location.hash = "&pgid="+guid+"&pid="+photo_id; // <-- Here is line
});
},
新模式窗口
開放模式URL後改變這樣的: http://work.example.rs/index.php/profile/photos#&pgid=E10B6F66-9686-9E29-55BA-3C197004F608&pid=6
在此網址ü可以看到URL #
加入我不知道whay?
HTML:
<?php $image_path = upload_userdata_url() .'/'. $photo->owner_id .'/'.'photos/'.$photo->photo_guid .'/'. $photo->photo_name;?>
<a href="<?= $image_path;?>" class="thumbnail" data-guid="<?= $photo->photo_guid; ?>" data-id="<?= $photo->photo_id; ?>" id="open-picture-modal" data-gallery>
<div class="uiMediaThumbImg" style="background-image: url(<?=$image_path;?>);"></div>
</a>
你知道是什麼'hash'是什麼? https://developer.mozilla.org/en/docs/Web/API/Window/location – llamerr
也你的PHP代碼看起來不像HTML,如你所說,如果你想發佈HTML - 只需發佈HTML瀏覽器 – llamerr
https ://en.wikipedia.org/wiki/Fragment_identifier – llamerr