Search Problem - Someone take a look please

Discussion in 'Programming' started by coladeu, Sep 21, 2012.

  1. #1
    Hi. This is a part of a javascript function from my php file and i want to make a small change to add a search command. Someone take a look please and tell me what i am doing wrong. I tried many various ways.
    $(function(){
        $('#content').scrollPagination({
            'contentPage': 'source.php', // the url you are fetching the results
    
    Code (markup):
    This is the change that i need to make and i don't know how to make it working so wen i acces the link like "mysite.com/source.php?search=blabla" to get the results from blabla word
    
    [B]$keyword = strip_tags($_GET['search']);[/B]
    $(function(){
        $('#content').scrollPagination({
            'contentPage': 'source.php[B]?search=[/B]'[B]$keyword,[/B] // the url you are fetching the results
    
    Code (markup):

     
    Solved! View solution.
    Last edited: Sep 21, 2012
    coladeu, Sep 21, 2012 IP
  2. WeddiGo

    WeddiGo Greenhorn

    Messages:
    40
    Likes Received:
    2
    Best Answers:
    2
    Trophy Points:
    18
    #2
    I think you may be missing a + to concatenate the string so something like:'source.php?search=' + $keyword
     
    WeddiGo, Sep 21, 2012 IP
  3. coladeu

    coladeu Peon

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    WeddiGo thanks for your advice but still not working, and if i put it like this source.php?search=blabla' it works ok. i cant figure it out how to make it. With php i'm good but javascript is to hard for me.
     
    coladeu, Sep 21, 2012 IP
  4. #4
    Ah I thought that was the problem, is $keyword php variable or JavaScript?
    Im ASP here so if it was an asp variable I would write it like this 'source.php?search=<%=keyword%>' ...note the single quotes, so the bit between <%= %> is asp and gets inserted.

    If you are using pure JavaScript then it should be
    var keyword = strip_tags(blah blah...)
    'source.php?search=' + keyword

    I think the $ should be var
     
    WeddiGo, Sep 21, 2012 IP
  5. coladeu

    coladeu Peon

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks Weddigo is working now i added this code "var keyword = "<?= strip_tags($_GET['search']); ?>" and it works with the + Thanks again
     
    coladeu, Sep 21, 2012 IP