Click here to Skip to main content
15,887,343 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have made a search engine for vehicles. It has 3 dropdowns and I am using $('select').CustomSelect(); to change their styles. When I run this search engine it works fine, all good.

However when I call the same thing through AJAX on another page, it shows error on this customselect line.

JavaScript
<script src="jquery-1.11.0.min.js" type="text/javascript"></script>
<script>
    $(document).ready(function(){
        // callsearchengine("allproducts", "");
        $("#searchengine").load('http://www.mywebsite.com/search/allproducts.php?id='); 
    });
</script>

The $('select').CustomSelect(); line is in the allproducts.php file.

Please help!

What I have tried:

I tried all possible ways, its been days am struggling with this.
Posted
Updated 23-Jan-17 0:00am
Comments
Afzaal Ahmad Zeeshan 23-Jan-17 5:48am    
What error?

Perhaps, the "callsearchengine" does not exist in the context and thus it gives the error.
Member 12963337 23-Jan-17 6:33am    
I am just getting $('...').CustomeSelect not a function.

the callsearchengine is commented.
i am loading a php file and that file contains the customselect call
Afzaal Ahmad Zeeshan 23-Jan-17 7:06am    
Ok, did you intentionally leave out the "r" in CustomerSelection?
Member 12963337 23-Jan-17 7:12am    
it was by mistake. but in my file it is $('...').CustomSelect()

Two things...
1. If you use that page as partial, you should clean it of all the HTML/HEAD/BODY/FORM things, and left only the main content... I twill load faster and you will have less problem with rendering...Or think about loading only page fragments: .load() | jQuery API Documentation[^]
2. JQuery's load will clear any JavaScript from your page prior putting the content in the specified element... So you have to link to external JavaScript if you want to use it...
 
Share this answer
 
I am just getting $('...').CustomeSelect not a function.
Is it not easily resolvable

As I understand what you say, but my searchengine should be able to work standalone also.
So cleaning etc. is going to take a lot of time
 
Share this answer
 
Comments
Kornfeld Eliyahu Peter 23-Jan-17 6:07am    
Do not post your comments as solution!!!
Member 12963337 23-Jan-17 6:08am    
Am new here , was by mistake.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900