Yii Framework Forum: jqAjaxSearch - how does it work? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

jqAjaxSearch - how does it work? Rate Topic: -----

#1 User is offline   nohero 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 04-January 10

Posted 04 January 2010 - 01:42 PM

Hi,
I recently started using the Yii framework and so far everything went well but now I tried to use the jqAjaxSearch extension and it won't work for me.

What i want it to do:
- Search my Database for Articles with titles, containing keywords, which were entered in the search bar

What i did so far:
- The widget is implemented so that I see the search bar
- it already calls my search function in my Controller
- it updates my search_results div tag in the view, displaying things specified in the controller

My Problem:
- I absolutely have no Idea where the entered input text (the search keywords) are stored
eg: User wants to search Articles containing the String "Health"
Now where i get the entered string?

my Code looks like this:

The Controller:
// here i want to implement the search functionality
public function actionSearch() {

            // here is the problem:
            // I want to know what has been entered in the search bar here

            echo "This is correctly displayed in the search_results div-tag";
           
            // will be used later for displaying the search results page and is working too
            //$this->renderPartial('search'); 
        }



The View (where my search bar is located):

<?php
$this->widget('application.extensions.jqAjaxSearch.AjaxSearch',
        array('action'=>array('search'), 'target'=>'search_results', 'minChar'=>2));
?>

<div id="search_results">
    
</div>


I really hope someone can help me. As I said before I just started over with Yii and I am not really familiar with the very basics like using widgets and accessing their content like the above described string.
I'm glad for any Tips & sorry for the noob question but maybe it will help other beginners too ^^

greez
nohero
0

#2 User is offline   nohero 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 04-January 10

Posted 04 January 2010 - 02:09 PM

Hi again :)

Problem solved ^^ I just got too far away from normal php while using the Yii framework :D

Solution:

I was all the time able to access the input values with the $_POST array -.-
sorry for the noob post! :)

    public function actionSearch() {
        
        echo $_POST["search_term"];
    }

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users