locked
Ajax, Jquery 1.10.1, syntax error RRS feed

  • Question

  • User1069198773 posted

    Hi. I'm using ajax with jquery 1.10.1. I have 1.aspx in Ajax folder. If I will add for example a link like auto.aspx?id=7286 in 1.aspx then I'm getting an error. Any url without '?' is working,  but with '?' it's not working. Can you please help me to solve the problem? It was working, the problem is occuring since 2 days, maybe was it any changes in Jquery 1.10.1 ?

    Wednesday, November 25, 2015 7:18 AM

All replies

  • User1724605321 posted

    Hi jfr,

    Could you please provide some of your code  ?

    Best Regards,

    Nan Yu

    Thursday, November 26, 2015 2:12 AM
  • User1069198773 posted

    Nan Yu,

      while (reader.Read())
            {
    
                if (Request.QueryString["status"] == "Непроданные")
                {
                    htmlStr.Append("<div class=\"item-list\"><div class=\"col-sm-2 no-padding photobox\"><div class=\"add-image\"> <span class=\"photo-count\"><i class=\"fa fa-camera\"></i> 2 </span> <a href=\"auto.aspx?id="+reader["empid"]+"\"><img class=\"thumbnail no-margin\" src=\"showimage.ashx?id=" + reader["empid"] + "\" alt=\"img\"></a> </div></div><!--/.photobox--><div class=\"col-sm-7 add-desc-box\"><div class=\"add-details\"><h5 class=\"add-title\"> <a href=\"auto.aspx?id="+reader["empid"]+"\">" + reader["marka"] + " " + reader["model"] + " " + reader["god"] + " года</a> </h5><span class=\"info-row\"> <span class=\"date\"><i class=\" icon-clock\"> </i> " + Convert.ToDateTime(reader["date"].ToString()).AddHours(2.0).ToString ("dd.MM.yyyy (HH:mm)") + " </span> - <span class=\"category\">" + reader["korobka"] + "</span> - <span class=\"item-location\"><i class=\"fa fa-map-marker\"></i> " + reader["gorod"] + " </span> </span> </div></div><!--/.add-desc-box--><div class=\"col-sm-3 text-right  price-box\"><h2 class=\"item-price\"> $ " + reader["price"] + " </h2><a class=\"btn btn-danger  btn-sm make-favorite\"> <i class=\" fa fa-trash\"></i> <span>Удалить</span> </a> <a class=\"btn btn-default  btn-sm make-favorite\"> <i class=\"fa fa-edit\"></i> <span>Изменить</span> </a> </div></div>"); 
                }
                else if (Request.QueryString["status"] == "Проданные")
                {
                    htmlStr.Append("<div class=\"item-list\"><div class=\"cornerRibbons urgentAds\"><a href=\"#\"> Продано</a></div><div class=\"col-sm-2 no-padding photobox\"><div class=\"add-image\"> <span class=\"photo-count\"><i class=\"fa fa-camera\"></i> 2 </span> <a href=\"auto.aspx?id=" + reader["empid"] + "\"><img class=\"thumbnail no-margin\" src=\"showimage.ashx?id=" + reader["empid"] + "\" alt=\"img\"></a> </div></div><!--/.photobox--><div class=\"col-sm-7 add-desc-box\"><div class=\"add-details\"><h5 class=\"add-title\"> <a href=\"auto.aspx?id=" + reader["empid"] + "\">" + reader["marka"] + " " + reader["model"] + " " + reader["god"] + " года</a> </h5><span class=\"info-row\"> <span class=\"date\"><i class=\" icon-clock\"> </i> " + Convert.ToDateTime(reader["date"].ToString()).AddHours(2.0).ToString("dd.MM.yyyy (HH:mm)") + " </span> - <span class=\"category\">" + reader["korobka"] + "</span> - <span class=\"item-location\"><i class=\"fa fa-map-marker\"></i> " + reader["gorod"] + " </span> </span> </div></div><!--/.add-desc-box--><div class=\"col-sm-3 text-right  price-box\"><h2 class=\"item-price\"> $ " + reader["price"] + " </h2><a class=\"btn btn-danger  btn-sm make-favorite\"> <i class=\" fa fa-trash\"></i> <span>Удалить</span> </a> <a class=\"btn btn-default  btn-sm make-favorite\"> <i class=\"fa fa-edit\"></i> <span>Изменить</span> </a> </div></div>");
                }
                else if (reader["status"].ToString() == "1")
                {
                    htmlStr.Append("<div class=\"item-list\"><div class=\"cornerRibbons urgentAds\"><a href=\"#\"> Продано</a></div><div class=\"col-sm-2 no-padding photobox\"><div class=\"add-image\"> <span class=\"photo-count\"><i class=\"fa fa-camera\"></i> 2 </span> <a href=\"auto.aspx?id=" + reader["empid"] + "\"><img class=\"thumbnail no-margin\" src=\"showimage.ashx?id=" + reader["empid"] + "\" alt=\"img\"></a> </div></div><!--/.photobox--><div class=\"col-sm-7 add-desc-box\"><div class=\"add-details\"><h5 class=\"add-title\"> <a href=\"auto.aspx?id=" + reader["empid"] + "\">" + reader["marka"] + " " + reader["model"] + " " + reader["god"] + " года</a> </h5><span class=\"info-row\"> <span class=\"date\"><i class=\" icon-clock\"> </i> " + Convert.ToDateTime(reader["date"].ToString()).AddHours(2.0).ToString("dd.MM.yyyy (HH:mm)") + " </span> - <span class=\"category\">" + reader["korobka"] + "</span> - <span class=\"item-location\"><i class=\"fa fa-map-marker\"></i> " + reader["gorod"] + " </span> </span> </div></div><!--/.add-desc-box--><div class=\"col-sm-3 text-right  price-box\"><h2 class=\"item-price\"> $ " + reader["price"] + " </h2><a class=\"btn btn-danger  btn-sm make-favorite\"> <i class=\" fa fa-trash\"></i> <span>Удалить</span> </a> <a class=\"btn btn-default  btn-sm make-favorite\"> <i class=\"fa fa-edit\"></i> <span>Изменить</span> </a> </div></div>");
                }
                else { htmlStr.Append("<div class=\"item-list\"><div class=\"col-sm-2 no-padding photobox\"><div class=\"add-image\"> <span class=\"photo-count\"><i class=\"fa fa-camera\"></i> 2 </span> <a href=\"auto.aspx?id=" + reader["empid"] + "\"><img class=\"thumbnail no-margin\" src=\"showimage.ashx?id=" + reader["empid"] + "\" alt=\"img\"></a> </div></div><!--/.photobox--><div class=\"col-sm-7 add-desc-box\"><div class=\"add-details\"><h5 class=\"add-title\"> <a href=\"auto.aspx?id=" + reader["empid"] + "\">" + reader["marka"] + " " + reader["model"] + " " + reader["god"] + " года</a> </h5><span class=\"info-row\"> <span class=\"date\"><i class=\" icon-clock\"> </i> " + Convert.ToDateTime(reader["date"].ToString()).AddHours(2.0).ToString("dd.MM.yyyy (HH:mm)") + " </span> - <span class=\"category\">" + reader["korobka"] + "</span> - <span class=\"item-location\"><i class=\"fa fa-map-marker\"></i> " + reader["gorod"] + " </span> </span> </div></div><!--/.add-desc-box--><div class=\"col-sm-3 text-right  price-box\"><h2 class=\"item-price\"> $ " + reader["price"] + " </h2><a class=\"btn btn-danger  btn-sm make-favorite\"> <i class=\" fa fa-arrow-up\"></i> <span>Поднять</span> </a> <a class=\"btn btn-default  btn-sm make-favorite\"> <i class=\"fa fa-edit\"></i> <span>Изменить/Удалить</span> </a> </div></div>"); }
                
     					 
    				
            }

    Friday, November 27, 2015 7:57 AM
  • User1069198773 posted
    /*	Table OF Contents
    	==========================
    	Carousel
    	Ajax Tab
    	List view , Grid view  and compact view
    	Global Plugins
    	Customs Script
    	responsive cat-collapse for homepage
    	*/
    	
    
    	
    $(document).ready(function() {
    
        /*==================================
    	 Carousel 
    	====================================*/
    
        // Featured Listings  carousel || HOME PAGE
        var owlitem = $(".item-carousel");
    
        owlitem.owlCarousel({
            //navigation : true, // Show next and prev buttons
            navigation: false,
            pagination: true,
            items: 5,
    		itemsDesktopSmall: 	[979,3],
    		itemsTablet: [768, 3],
            itemsTabletSmall: [660, 2],
    		itemsMobile: [400,1]
    
    
        });
    
        // Custom Navigation Events
        $("#nextItem").click(function() {
            owlitem.trigger('owl.next');
        })
        $("#prevItem").click(function() {
            owlitem.trigger('owl.prev');
        })
    
    
    
        /*==================================
    	 Ajax Tab || CATEGORY PAGE
    	====================================*/
    
        //  item listing ajaxTabs 
        $('#ajaxTabs a').click(function(e) {
            e.preventDefault();
    
            var url = $(this).attr("data-url");
            var href = this.hash;
            var pane = $(this);
    
            // ajax load from data-url
            $(href).load(url, function(result) {
                pane.tab('show');
                // ajax pre-request callback function 
                $('.tooltipHere').tooltip();
                $('.grid-view').click(function(e) {
                    $(function() {
                        $('.item-list').matchHeight();
                        $.fn.matchHeight._apply('.item-list');
                    });
                });
    
            });
        });
    
        // load first tab content
        $('#allAds').load($('.active a').attr("data-url"), function(result) {
            $('.active a').tab('show');
            // ajax pre-request callback function 
            $('.tooltipHere').tooltip();
    
            $('.grid-view').click(function(e) {
                $(function() {
                    $('.item-list').matchHeight();
                    $.fn.matchHeight._apply('.item-list');
                });
            });
        });
    
        /*==================================
    	 List view clickable || CATEGORY 
    	====================================*/
    
        // List view , Grid view  and compact view
    
        $('.list-view,#ajaxTabs li a').click(function(e) { //use a class, since your ID gets mangled
            e.preventDefault();
            $('.grid-view,.compact-view').removeClass("active");
            $('.list-view').addClass("active");
            $('.item-list').addClass("make-list"); //add the class to the clicked element
            $('.item-list').removeClass("make-grid");
            $('.item-list').removeClass("make-compact");
            $('.item-list .add-desc-box').removeClass("col-sm-9");
            $('.item-list .add-desc-box').addClass("col-sm-7");
    
            $(function() {
                $('.item-list').matchHeight('remove');
            });
        });
    
        $('.grid-view').click(function(e) { //use a class, since your ID gets mangled
            e.preventDefault();
            $('.list-view,.compact-view').removeClass("active");
            $(this).addClass("active");
            $('.item-list').addClass("make-grid"); //add the class to the clicked element
            $('.item-list').removeClass("make-list");
            $('.item-list').removeClass("make-compact");
            $('.item-list .add-desc-box').removeClass("col-sm-9");
            $('.item-list .add-desc-box').addClass("col-sm-7");
    
            $(function() {
                $('.item-list').matchHeight();
                $.fn.matchHeight._apply('.item-list');
            });
    
        });
    
    
    
        $('.compact-view').click(function(e) { //use a class, since your ID gets mangled
            e.preventDefault();
            $('.list-view,.grid-view').removeClass("active");
            $(this).addClass("active");
            $('.item-list').addClass("make-compact"); //add the class to the clicked element
            $('.item-list').removeClass("make-list");
            $('.item-list').removeClass("make-grid");
            $('.item-list .add-desc-box').toggleClass("col-sm-9 col-sm-7");
    
            $(function() {
                $('.adds-wrapper .item-list').matchHeight('remove');
            });
    
        });
    
    
    
        /*==================================
    	Global Plugins || 
    	====================================*/
    
        $('.long-list').hideMaxListItems({
            'max': 5,
            'speed': 500,
            'moreText': ' >>> ([COUNT])'
        });
    
    
        $('.tooltipHere').tooltip(); // bootstrap tooltip
    
        $(".scrollbar").scroller(); // custom scroll bar plugin
    
        $("select.selecter").selecter({ // custom scroll select plugin
            label: "Select An Item"
        });
    
        $(".selectpicker").selecter({ // category list Short by
            customClass: "select-short-by"
        });
    
    
    
    
        /*=======================================================================================
    		cat-collapse Hmepage Category Responsive view  
    	========================================================================================*/
    	
    	
    
        $(window).bind('resize load', function() {
    	
    	
    		
            if ($(this).width() < 767) {
    
            $('.cat-collapse').collapse('hide');
    		
                $('.cat-collapse').on('shown.bs.collapse', function() {
                    $(this).prev('.cat-title').find('.icon-down-open-big').addClass("active-panel");
                    //$(this).prev('.cat-title').find('.icon-down-open-big').toggleClass('icon-down-open-big icon-up-open-big');
                });
    
                $('.cat-collapse').on('hidden.bs.collapse', function() {
                    $(this).prev('.cat-title').find('.icon-down-open-big').removeClass("active-panel");
                })
    
            } else {
    			
    		$('.cat-collapse').removeClass('out').addClass('in').css('height', 'auto');
               
            }
    		
        });
    
    	
    
    }); // end Ready
    
    
    	
    

    Friday, November 27, 2015 9:24 AM
  • User1069198773 posted

    Nan Yu

    Maybe the problem is because of it? 

    $('#ajaxTabs a').click(function(e) {
           e.preventDefault();
    
           var url = $(this).attr("data-url");
           var href = this.hash;
           var pane = $(this);
    
           // ajax load from data-url
    $(href).load(url, function(result) {
               pane.tab('show');
               // ajax pre-request callback function 
    $('.tooltipHere').tooltip('hide');
               $('.grid-view').click(function(e) {
                   $(function() {
                       $('.item-list').matchHeight();
                       $.fn.matchHeight._apply('.item-list');
                   });
               });
    
           });
       });

    Friday, November 27, 2015 9:34 AM
  • User1724605321 posted

    Hi jfr,

    Then please debug your application to confirm does any error message on your screen .  And how about simply create <a> tag with your query string value in your markup and confirm the page redirect to the correct page .

    Best Regards,

    Nan Yu

    Monday, November 30, 2015 2:02 AM