簡體   English   中英

如何在與搜索表單元素相同的頁面上顯示搜索結果?

[英]How can I display search results on the same page as the search form element?

我有一個包含以下形式的元素:

<?php
echo $this->Form->create('PrototypeItem', array(
    'url' => array('instance' => $instance['PrototypeInstance']['slug'])
    , 'class' => 'simple-search'
    , 'action' => '/search'

));
echo $this->Form->input('search', array(
    'label' => 'Search',
    'type' => 'text'
));
echo $this->Form->end('Search');
?>

<!-- code for displaying search results here -->

以前,該元素是在位於site.com/realtor-documents/search的頁面上調用的,並且工作正常。

但是,設計師要求我將搜索表單移至site.com/realtor-documents,以消除額外的點擊。 因此,該表單現在位於/ realtor-documents,但是當我提交該表單時,它仍然重定向到/ realtor-documents / search。 我希望結果顯示在與/ realtor-documents表單相同的頁面上。 我怎樣才能做到這一點?

這是因為'action' => '/search' ,將其替換為'action' => ''以便它在同一頁面上發送結果。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM