#1 (permalink)  
Alt 20.08.2009, 13:41
Neuer Benutzer
 
Registriert seit: 14.11.2005
Beiträge: 5
Standard Ajax Suche mit Dropdown Problem

Hallo Community,
ich komme einfach nicht weiter und hoffe Ihr könnt mir helfen.

Es geht um eine Ajax Suche mit Dropdown

Hier mein bisheriger Code:

ajax.php
PHP-Code:
<?php

if (isset($_GET['id']) && $_GET['id'] != 'all' ) {
    
$herst_id = (int)$_REQUEST['id'];
    
$json = array();
    
//Verbindung zur Datenbank herstellen...
    
$query "select manufacturers_id, manufacturers_name from " TABLE_MANUFACTURERS " where manufacturers_id = " $herst_id;
    
$result mysql_query($query);
    while (
$row mysql_fetch_assoc($result)) {
        
array_push($json, array(
            
'oV' => $row['manufacturers_id'],
            
'oT' => $row['manufacturers_name']
        ));
    }
    echo 
json_encode($json);
}

?>
script.js
Code:
$(function() {
    $('#hersteller').change(function(){
        $.ajax({
            url: ('ajax.php'),
            data: 'id=' + $(this).val(),
            type: 'GET',
            timeout: 2000,
            dataType: 'json',
            error: function() {
                alert('Error loading json data!');
            },
            success: function(json){
                var output = '';
                for (p in json) {
                    output += '<option value=\"' + json[p].oV + '\">' + json[p].oT + '</option>\n';
                }
                $('#typ').html(output);
            }
        })
    });
});
neuesuchbox.html
HTML-Code:
{literal}
<script type="text/javascript" src="script.js"></script>
{/literal}
 
<label for="hersteller">Hersteller</label>
<select name="hersteller" id="hersteller">
    <option value="all">- alle -</option>
    <option value="1">Herrsteller 1</option>
    <option value="2">Herrsteller 2</option>
    <option value="3">Herrsteller 3</option>
</select>

<label for="typ">Typ</label>
<select name="typ" id="typ">
    <option value="all">- alle -</option>
</select>
Das ganze soll mehr oder weniger für eine spezielle suche genutzt werden.
Den Produkten wurden noch zusätzliche Infos mitgegeben die durch diese suche gefiltert werden sollen.

Mein Problem ist nun das ich keine Daten aus der DB erhalte egal was ich bisher angestellt habe es kam nichts an .

Vielleicht stehe ich ja auch nur auf dem Schlauch !


EDIT:
Fehlermeldungen gibt es nur die eine
"Error loading json data"

Bitte um Hilfe.

greets
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
Antwort

Lesezeichen

Stichworte
ajax, dropdown, problem, suche

Themen-Optionen
Ansicht

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are aus
Pingbacks are aus
Refbacks are aus


Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
Suche Erweiterte Suche Bringt Problem :/ Oi Ben Shopbereich 9 13.04.2005 11:57


Alle Zeitangaben in WEZ +1. Es ist jetzt 16:34 Uhr.

Copyright © 2011 xt:Commerce GmbH / xt:Commerce International Ltd. - All Rights Reserved

xt:Commerce is a SafeCharge brand