0

I'm having an issue with the .load function or one of the other functions. I'm doing a .change then a .load for an HTML select, but every time it returns the select tag with []. Here is a video on it.

http://gyazo.com/75a3f2b2da3f9f32b3943e512025e643

The Javascript code:

$(document).ready(function(){
    $("#ticket_dep").change(function(){
        $("#result").html('Retrieving ...');
        var selected = parseInt($('#ticket_dep').val());
        $("#result").load("<?=URL_CP?>includes/json.php?function=changeareaadmin",{'dep_id':selected});
    });
});

The HTML code:

<tr>
    <td class="col-md-4" align="right">Assign Ticket</td>
    <td class="col-md-8">
    <form>
        <div id="result"></div>
    </form>
    </td>
</tr>

And the PHP code:

case "changeareaadmin":
    if(isset($_POST["dep_id"])) {

        $display = "<select name='ladder' class='form-control pull-left'><option>sssweewfeffe</option></select>";           
        echo $display;
    }
    break;
2
  • Why did you tag this Java? There's no Java here. Commented Apr 18, 2015 at 2:10
  • This isn't java. Java and javascript are completely different. Replace your java tag for jQuery Commented Apr 18, 2015 at 2:10

1 Answer 1

2

The jQuery load function expects the server to return html but it appears that your server is returning json which I might expect from something called json.php.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you.. Once I tested what you said it was the json array. So I just made a new file for these type of things. Now it working.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.