logo
down
shadow

conversion of php/asp ajax example to jsp


conversion of php/asp ajax example to jsp

By : user2956027
Date : November 22 2020, 10:48 AM
will help you What I understand is that you want to convert the PHP/ASP code to jsp. Here is the jsp code. Please save this code in gethint.jsp page and in the html page change the URL to target the jsp page
code :
<%@page import="java.util.Arrays"%>
<%
// Array with names
String hint = " "; 
String[] a = {
    "Anna","Brittany","Cinderella","Diana","Eva","Fiona","Gunda",
    "Hege","Inga","Johanna","Kitty","Linda","Nina","Ophelia"
    ,"Petunia","Amanda","Raquel","Cindy","Doris","Eve","Evita","Sunniva"
   ,"Tove","Unni","Violet","Liza","Elizabeth","Ellen","Wenche","Vicky"
   };
   // get the q parameter from URL
   String q = request.getParameter("q");

   if (q != " ") {
   for(String name : a )
   {
     if(name.toLowerCase().startsWith(q.toLowerCase()))
     {
        if(hint == " ")
        {
           hint = name;
        }
        else
        {
            hint = hint + ", " + name;
        }
    }
  }
 }

 if(hint == " ")
 {
   out.println("No suggestion");    
 }
 else{
 out.println(hint);
  }

  %>


Share : facebook icon twitter icon
Ajax xml httprequest to jquery conversion

Ajax xml httprequest to jquery conversion


By : James Harris
Date : March 29 2020, 07:55 AM
will help you I'm pretty new to javascript / ajaax / jquery, but I was able to figure out the following ajax script. Unfortunately it doesn't work cross browser... as far as I can tell, not in any IE versions... I'm wondering if anyone can help me out with how to convert it to jquery? I heard that is way better than using ajax.
code :
<head>
    .......

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js" type="text/javascript"></script>

    <script type="text/javascript">
        $(document).ready(function() {
            initialize();
            showClock();

            (function checkRefresh() {
                $.ajax({
                    url: 'getnewid.php',
                    success: function(data) {
                        if (parseInt($('#lastCallID').html()) < parseInt(data)) GoPopUp();
                        else setTimeout(checkRefresh, 15000);
                    }
                });
            })();
        });
    </script>

    .......
</head>

<body>
    .......
</body>
Normal AJAX to jquery conversion

Normal AJAX to jquery conversion


By : Tootrill Blue
Date : March 29 2020, 07:55 AM
Any of those help , Try
code :
$('#page-01').on('click', function () {
    $.ajax({
        type: "GET",
        url: "includes/funkcije.php",
        data: "min=0&max=10",
        success: function(data) {
            $('#test').text(data);
        }
    });
});

$('#page-02').on('click', function () {
    $.ajax({
        type: "GET",
        url: "includes/funkcije.php",
        data: "min=10&max=20",
        success: function(data) {
            $('#test').text(data);
        }
    });
});
<li><a id="page-01" href="javascript:func1(0,10)">1</a></li>
<li><a id="page-02" href="javascript:func1(10,20)">2</a></li>
var func1 = function(min, max) {
    $.ajax({
        type: "GET",
        url: "includes/funkcije.php",
        data: "min=" + min + "&max=" + max,
        success: function(data) {
            $('#test').text(data);
        }
    });        
}
Ajax response conversion

Ajax response conversion


By : user3445085
Date : March 29 2020, 07:55 AM
I wish did fix the issue. You can parse the data you received from the ajax response to create the array.
code :
var populateArray = function (ajaxResponse) {
    var newArray = [];
    ajaxResponse.forEach(function (item, index) {
        var props = item.split('|');
        var obj = {
            date: props[0],
            downloads: props[1]
        };
        newArray.push(obj)
    });

    return newArray;
}
console.log(populateArray(["07Apr|1", "06Apr|3", "05Apr|12", "04Apr|11", "03Apr|0", "02Apr|0", "01Apr|6", "31Mar|0", "30Mar|7", "29Mar|16", "28Mar|5", "27Mar|5", "26Mar|12", "25Mar|9", "24Mar|4", "23Mar|10", "22Mar|16", "21Mar|2", "20Mar|19", "19Mar|22", "18Mar|10", "17Mar|11", "16Mar|10", "15Mar|19", "14Mar|0", "13Mar|4", "12Mar|14", "11Mar|5", "10Mar|26", "09Mar|7", "08Mar|5"]));
Cannot convert type via a reference conversion, boxing conversion, unboxing conversion, wrapping conversion, or null typ

Cannot convert type via a reference conversion, boxing conversion, unboxing conversion, wrapping conversion, or null typ


By : user3813692
Date : March 29 2020, 07:55 AM
help you fix your problem You cannot cast a List of one type to a List of a different type.
And if you think about it, you would be glad that you can't. Imagine the havoc you could cause if it was possible:
code :
 interface ICustomRequired
 {
 }

 class ImplementationOne : ICustomRequired
 {
 }

 class ImplementationTwo: ICustomRequired
 {
 }

 var listOne = new List<ImplementationOne>();
 var castReference = listOne as List<ICustomRequired>();
 // Because you did a cast, the two instances would point
 // to the same in-memory object

 // Now I can do this....
 castReference.Add(new ImplementationTwo());

 // listOne was constructed as a list of ImplementationOne objects,
 // but I just managed to insert an object of a different type
 exampleList as IEnumerable<ICustomRequired>;
var newList = (exampleList as IEnumerable<ICustomRequired>).ToList();
var newList = exampleList.Cast<ICustomRequired>().ToList();
Prototype conversion ajax.updater

Prototype conversion ajax.updater


By : CatiaDr
Date : March 29 2020, 07:55 AM
To fix the issue you can do It is possible that the way you are providing the data field might be the issue here. Try something like the following:
shadow
Privacy Policy - Terms - Contact Us © ourworld-yourmove.org