PDA

View Full Version : Live Search, What is submitted to php?



parsbin
29 May 2011, 11:08 PM
Hi
i made a live search in extjs and a php file, which feedback the research results to extjs file.
i`v attached js codes in bottom, but i want to know how i could send the searched characters to my php file for create true output.
how can do this?





Ext.onReady(function(){
var ds = new Ext.data.Store({
url: 'output.php'
,
reader: new Ext.data.JsonReader({
root: 'topics',
totalProperty: 'totalCount',
id: 'post_id'
}, [
{name: 'title', mapping: 'topic_title'},
{name: 'topicId', mapping: 'topic_id'},
{name: 'author', mapping: 'author'},
{name: 'lastPost', mapping: 'post_time', type: 'date', dateFormat: 'timestamp'},
{name: 'excerpt', mapping: 'post_text'}
])
});

// Custom rendering Template
var resultTpl = new Ext.XTemplate(
'<tpl for="."><div class="search-item">',
'<h3><span>{lastPost:date("M j, Y")}<br />by {author}</span>{title}</h3>',
'{excerpt}',
'</div></tpl>'
);

var search = new Ext.form.ComboBox({
store: ds,
displayField:'title',
typeAhead: false,
minChars:3,
loadingText: 'Searching...',
width: 570,
pageSize:10,
hideTrigger:true,
tpl: resultTpl,
applyTo: 'search',
itemSelector: 'div.search-item',
onSelect: function(record){ // override default onSelect to do redirect
window.location =
String.format('http://extjs.com/forum/showthread.php?t={0}&p={1}', record.data.topicId, record.id);
}
});
});

parsbin
1 Jun 2011, 1:44 AM
i`v found answer.
requests : start,limit and query